Comments (6)
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.
from wamp-rs.
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?
from wamp-rs.
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!
from wamp-rs.
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..
from wamp-rs.
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.
from wamp-rs.
It should be possible to read the cookie in Handler::on_request()
housleyjk/ws-rs#110
from wamp-rs.
Related Issues (12)
- Router crashes when clients connect to nonexistent realm HOT 2
- Support for Serialization/Deserialization HOT 1
- Typos HOT 1
- Server stops responding after a while HOT 12
- Client connection being closed HOT 5
- Authentication methods
- Callback type of `Client::register` and `Client::subscribe` produces lifetime issues in closures HOT 1
- Panic when the websocket connection fails (no result produced)
- wss support (security connection) HOT 3
- Is having random IDs an issue?
- Future of this crate HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wamp-rs.