-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
How to get a client socket from rocket? #353
Comments
There's no support for either of these in Rocket. I'm not sure how they would work, actually; Rocket (Hyper, really) needs to handle the client socket directly to properly implement HTTP. This is a pretty odd thing to want to do. From the sound of it, you'd be better off having the client connect to two different servers. Can you perhaps explain what you're actually trying to do? |
I need to provide a custom logic for sockets but they must also work as simple http client. So, I want to have a persistent connection between a client and the server. This how it should work:
I could work without |
This is definitely outside the scope of Rocket, at least for the time being. Something like WebSockets is likely more amenable to solving your problem. You're essentially trying to implement a publish/subscribe and broadcasting mechanism, something that web sockets is perfect for. Rocket will eventually have support for web sockets out of the box (#90). Until then, you can use one of the available Rust web socket libraries. I've included information about how to use them alongside Rocket in #90 (comment). |
@SergioBenitez thanks for the answer! Close the issue if you think it is needed to be closed. |
Hello again! Has anything been changed since our last discussion? I see there is a
So I think it would be not very difficult to add a If you still think that it is very bad to do this in rocket itself, could you give me any hint how I could use rocket and get a socket handle, just any method please, because the framework is very simple to use and useful and I don't want to waste my time on rewriting my server in other frameworks or even from scratch using linux's headers. |
I need to get a client socket from rocket's handler and to work with it later. Is this possible to do?
Or, I may handle connections with another thread and to pass client's socket requests to the rocket instance.
To clarify my intentions, this is what I need:
hashmap
.X -> Rocket <- Y
As from what I think this can be done in 2 different ways:
rocket
itself and get sockets from there.The text was updated successfully, but these errors were encountered: