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

What's the status? #1

Closed
Boscop opened this issue Mar 10, 2017 · 6 comments
Closed

What's the status? #1

Boscop opened this issue Mar 10, 2017 · 6 comments

Comments

@Boscop
Copy link

Boscop commented Mar 10, 2017

Does this work with the latest ws-rs and serde?

@dyule
Copy link
Owner

dyule commented Mar 10, 2017

It does now! This is part of some other work I've been doing, and I've been focused on those, but with the recent massive changes to serde, it makes sense to bring this up to date.

@dyule dyule closed this as completed Mar 10, 2017
@Boscop
Copy link
Author

Boscop commented Mar 10, 2017

Thanks! Btw, which js lib would you recommend to use in the browser to communicate with wamp-rs?
I want to do a web gui for a Rust app, so I need to send key strokes, events, and the server needs to push gui data updates.

And for a different app I want to send push notifications to users, so I need to read the user id from the cookie when a websocket connection comes in, is this possible with wamp-rs?

@dyule
Copy link
Owner

dyule commented Mar 10, 2017

I've personally used AutobahnJS for my websocket library in Javascript, and had no problems at all.

As for reading from a cookie, I don't think the WAMP protocol supports that directly, since the router isn't supposed to do anything but relay messages, and the cookie would get lost by the time it got to the callee. I suspect you'd be best to store a user ID (or maybe the session id) in localStorage on the client side, and then pass that along. Another thing that might be useful is the publish blacklist/whitelist feature, which is part of the advanced profile, but hasn't been implemented here yet.

Something you could do, if your user id was 1234, is subscribe to a topic like com.my.topic.1234. Then you can publish to com.my.topic.1234 for that particular user. However, given that WAMP-RS doesn't currently support user authentication, you'd have to be careful about security there.

I hope those random thoughts help. Any feature you would like to see in WAMP-RS, feel free to request it, or better yet, implement!

@Boscop
Copy link
Author

Boscop commented Mar 11, 2017

Thanks. But how can I authenticate users without cookies so that nobody can impersonate another user?
Also, with publishing, doesn't that send all messages to all clients, and they then decide which ones to look at? That would cause a lot of unnecessary traffic. If possible I want to send only to the client that should get the message..

@dyule
Copy link
Owner

dyule commented Mar 11, 2017

For authentication, until I (or someone else) implements it in WAMP-RS, I don't know how you might do it. The ws library didn't support cookies when last I checked, although they might now. I guess that's a pretty critical feature for what you're trying to accomplish. But with publishing, no every client doesn't see every message. They only see the messages for topics they are subscribed to. So as long as each user had their own topic for messages, only they would see the notifications.

@Boscop
Copy link
Author

Boscop commented Mar 11, 2017

It should be possible to read the cookie in Handler::on_request()
housleyjk/ws-rs#110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants