Skip to content

Instantly share code, notes, and snippets.

@bergusman
Last active June 9, 2021 15:49
Show Gist options
  • Select an option

  • Save bergusman/285221103605b46ccd800d6f0b2cebf1 to your computer and use it in GitHub Desktop.

Select an option

Save bergusman/285221103605b46ccd800d6f0b2cebf1 to your computer and use it in GitHub Desktop.
Chat
switch (message.event) {
case 'user_updated':
sockets.publish(message.userId, {
jsonrpc: '2.0',
method: 'user_updated',
params: message.user
})
break
case 'booking_updated':
sockets.publish(message.userId, {
jsonrpc: '2.0',
method: 'booking_updated',
params: message.booking
})
break
case 'message':
sockets.publish(message.userId, {
jsonrpc: '2.0',
method: 'message',
params: {
booking_id: message.bookingId,
message: message.message
}
})
break
case 'admin_read':
sockets.publish(message.userId, {
jsonrpc: '2.0',
method: 'admin_read',
params: {
booking_id: message.bookingId,
}
})
break
case 'admin_typing':
sockets.publish(message.userId, {
jsonrpc: '2.0',
method: 'admin_typing',
params: {
booking_id: message.bookingId,
}
})
break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment