Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose NetworkStream+Send to the server #521

Closed
lightningdev45 opened this issue May 10, 2015 · 6 comments · Fixed by #631
Closed

Expose NetworkStream+Send to the server #521

lightningdev45 opened this issue May 10, 2015 · 6 comments · Fixed by #631
Assignees
Labels
A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@lightningdev45
Copy link

I need access to the downcast methods on NetworkStream+Send on the server in order to gain access to a TcpStream object. This will allow me to implement an iron middleware to upgrade connections to websocket connections, following the work already done in rust-websockets.

Iron currently only has access to a NetworkStream which is obtained by calling "deconstruct" on the request object provided by hyper.

@seanmonstar seanmonstar added A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor. labels May 11, 2015
@seanmonstar
Copy link
Member

The changes to do here is to change the &'a NetworkStream in hyper::server::Request to be &'a (NetworkStream + Send).

@reem
Copy link
Contributor

reem commented May 11, 2015

Alternatively just add downcasting to NetworkStream proper, in addition to the impl for NetworkStream + Send.

@seanmonstar
Copy link
Member

Ah yes, we could duplicate the definition for impl NetworkStream (grumble grumble)...

@lightningdev45
Copy link
Author

I'm going to attempt to make the changes myself using the first proposed solution. If I get stuck I'll post on this thread. When I'm ready I'll make a PR

@seanmonstar
Copy link
Member

The second one would be easier. The first would be preferred if there's a need to send that trait object to another thread...

@lightningdev45
Copy link
Author

Wouldn't that be useful? For instance, I initialize a websocket connection. Later on, my client makes an http request and that request wants to be able to send data through the websocket while the new request is still processing. I'm just not sure if this scenario would require passing NetworkStream+Send to more than one thread(my intuition tells me it would). In any case I will attempt both

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants