Created
August 1, 2014 01:31
-
-
Save madprops/dc0e2d9bc5006b0e29ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have this in views.py | |
def connection_factory(auth_class, pubsub): | |
class GeneratedConnection(websocket_connection_factory(auth_class, pubsub)): | |
def open_connection(self): | |
log(self.authenticator) | |
return super(GeneratedConnection, self).open_connection() | |
def close_connection(self): | |
return super(GeneratedConnection, self).close_connection() | |
def command_subscribe(self, args): | |
return super(GeneratedConnection, self).command_subscribe(args) | |
return GeneratedConnection | |
I have this in a js file: | |
function create_omnibus(endpoint, auth) | |
{ | |
console.log(auth) | |
var options = | |
{ | |
authToken: auth | |
} | |
return new Omnibus(WebSocket, endpoint, options) | |
} | |
this is what I'm getting for the auth token: | |
2:09310427bc3b59b5524be6a57225475afee459ae | |
Basically what I need is a way to know which django users are connected on a certain room. | |
So I was planning on using the overriden connection functions to log in redis or something when a user connects and leaves as well as the room name, so I can have a list of users per room. | |
The problem with this approach I'm trying is that I can't get the user instance/name: | |
def open_connection(self): | |
log(self.authenticator) | |
return super(GeneratedConnection, self).open_connection() | |
That log returns False | |
I'm going to need the room name as well. | |
Maybe there's an easier way? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment