Show:

Users.Socket Class

Some replacements for Q.Socket methods, use these instead. They implement logic involving sockets, users, sessions, devices, and more. Everything goes through the "Users" namespace in socket.io

Item Index

Methods

Events

Methods

connect

(
  • nodeUrl
  • callback
)
static

Connects a socket, and stores it in the list of connected sockets. But it also sends a "Users.session" message upon socket connection, to tell connect the session id to the socket on the back end.

Parameters:

  • nodeUrl String

    The url of the socket.io node to connect to

  • callback Function

    When a connection is made, receives the socket object

get

(
  • url
)
Q.Socket static

Returns a socket, if it was already connected, or returns undefined

Parameters:

  • url String

    The url where socket.io is listening. If it's empty, then returns all matching sockets.

Returns:

Events

onEvent

Returns Q.Event that occurs on some socket event coming from socket.io through the Users namespace

Event Payload:

  • name String

    the name of the event