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
1.0.0 Replacements for socket.set() and socket.get() #1481
Comments
It definitely should be safe to store properties on the object. The reason I'm removing it is that I don't want persistence at the socket.io layer. We can build that in other modules. I'm definitely including a polyfill as part of the migration guide, however. |
@guille Is it ready in 0.9.x as well? To make code ready for 1.0 and get rid of those get and set calls adding unnecessary callback nesting? Or object passed as |
I don't see any polyfill in the migration guide. How is this done in 1.0 exactly? i'm using this as middleware for now: configurable = require 'configurable'
module.exports = (socket, next) ->
configurable socket
next() |
Any resolution or best practice for replacing old .set() and .get() -> we should instead use a prop directly on client object? Is there a module ( as mentioned above ) that does this more elegantly? |
You used to be able to store arbitrary data along with a socket, using
socket.get(key, callback)
andsocket.set(key, value, callback)
. How can we do this in 1.0.0?Just setting random values on the socket seems to work, but doesn't sound safe. e.g.
socket.foo = 'bar'
.The text was updated successfully, but these errors were encountered: