Skip to content

Message formats documentation

Sam Shull edited this page Nov 26, 2013 · 2 revisions

Resource

Incoming

  • subscribe: adds listener for messages publish'ed to the given to parameter { op: 'subscribe', to: '{resourceType}:/{accountName}/{scope}' }
  • unsubscribe: removes listener added by subscribe
    { op: 'unsubscribe', to: '{resourceType}:/{accountName}/{scope}' }

Presence

Incoming

  • get: get the values of a presence
    1. { op: 'get', to: 'presence:/{accountName}/{scope}' } - sends Presence.Outgoing.get.Version 1 as response
    2. { op: 'get', to: 'presence:/{accountName}/{scope}', options: { version: 2 } } - sends Presence.Outgoing.get Version 2 as response
  • sync: subscribe to a presence and get the current presence values
    1. { op: 'sync', to: 'presence:/{accountName}/{scope}' } - sends Presence.Outgoing.online sync response as response
    2. { op: 'sync', to: 'presence:/{accountName}/{scope}', options: { version: 2 } } - sends Presence.Outgoing.get Version 2 as response

Outgoing

  • online: a presence entry was added for a user { op: 'online', to: 'presence:/{accountName}/{scope}', value: {Object({ '{Number(userId)}': '{Number(userType)}' }) }, userData: {Object} }
  • online - sync response: sync on a presence results in
    { op: 'online', to: 'presence:/{accountName}/{scope}', value: {Object({ '{Number(userId)}': '{Number(userType)}' })} }
  • offline: all presence entries were removed for a user { op: 'offline', to: 'presence:/{accountName}/{scope}', value: { '{Number(userId)}': '{Number(userType)}' } }
  • client_online: a presence entry was added for a client that a user is using to communicate with Radar (multiple per user possible) { op: 'client_online', to: 'presence:/{accountName}/{scope}', value: { userId: {Number}, clientId: {String}, userData: {Object} } }
  • client_offline: the presence entry was removed for a client that a user is using to communicate with Radar { op: 'client_offline', to: 'presence:/{accountName}/{scope}', value: { userId: {Number}, clientId: {String} } }
  • get - Version 1: sent as a response to a Presence.Incoming.get operation { op: 'get', to: '{original name}', value: {Object({ '{Number(userId)}': '{Number(userType)}' })} }
  • get - Version 2: sent as a response to a Presence.Incoming.sync.Version 2 operation { op: 'get', to: '{original name}', value: {Object({ '{Number(userId)}': { userType: '{Number}', clients: {Object({ '{clientId}': '{userData || {}}' })} })}

Status

Incoming

  • get: sends Status.Outgoing.get as reciprocal { op: 'get', to: 'status:/{accountName}/{scope}' }
  • set: { op: 'set', to: 'status:/{accountName}/{scope}', value: {Object}, key: {Number | String}, type: {Number} }
  • sync: sends Status.Outgoing.get as reciprocal { op: 'sync', to: 'status:/{accountName}/{scope}' }

Outgoing

  • get: { op: 'get', to: '{name used in original request}', value: {Object({ {userId}: {value} })} }

MessageList

Incoming

  • sync: sends MessageList.Outgoing.sync as reciprocal message { op: 'sync', to: 'message:/{accountName}/{scope}' }
  • publish: sends a message to the listener(s) that are subscribe'ed { op: 'publish', to: 'message:/{accountName}/{scope}', value: {Object} }

Outgoing

  • sync: sent as response to MessageList.Incoming.sync { op: 'sync', to: '{name used in original request}', time: Date.now(), value: [ {data, timestamp}* ] }
Clone this wiki locally