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

Native WebSocket support #90

Open
net opened this Issue Jan 1, 2017 · 5 comments

Comments

4 participants
@net

net commented Jan 1, 2017

I think Rocket would benefit heavily from native WebSocket support. Even better would be something similar to Phoenix's channels.

It's great to see such a comprehensive web framework for Rust coming together!

@jsen-

This comment has been minimized.

jsen- commented Jan 2, 2017

@net did you manage to combine rocket with eg. websocket on the same host:port?
I'm trying to upgrade connection to ws, but no luck so far :(

@SergioBenitez SergioBenitez added this to the 0.60 milestone Jan 3, 2017

@SergioBenitez

This comment has been minimized.

Owner

SergioBenitez commented Jan 3, 2017

This is indeed planned.

@SergioBenitez SergioBenitez modified the milestones: 0.6.0, 0.7.0 Jan 3, 2017

@wagenet

This comment has been minimized.

wagenet commented May 1, 2017

@SergioBenitez got any suggestions for how one could manually add web socket support?

@SergioBenitez

This comment has been minimized.

Owner

SergioBenitez commented May 29, 2017

@wagenet Do you mean to Rocket or to your web application? The former is subtle is it requires a lot of design work, but the latter should be straightforward. You should be able to use the websocket or ws-rs crates as they are intended. You won't be able to use the same port for both servers, of course. And, you'll need to spawn one of the two servers in a separate thread so that one server doesn't block the other one from starting. Should you choose to do this, your main function would look something like:

fn main() {
    thread::spawn(|| {
        listen("127.0.0.1:3012", |out| {
            move |msg| {
                out.send(msg)
           }
        })
    })

    rocket.ignite()..more()..launch()
}
@wagenet

This comment has been minimized.

wagenet commented May 30, 2017

@SergioBenitez thanks :) I ended up discovering this sort of approach myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment