-
Notifications
You must be signed in to change notification settings - Fork 30
Example WebSocket Messages
Mike Angstadt edited this page Jul 15, 2017
·
9 revisions
New message:
{
"r1":{
"e":[
{
"event_type":1,
"time_stamp":1498317444,
"content":"test",
"id":76625573,
"user_id":13379,
"user_name":"Michael",
"room_id":1,
"room_name":"Sandbox",
"message_id":37799434
}
],
"t":76625573,
"d":1
}
}Edited message:
{
"r1":{
"e":[
{
"event_type":2,
"time_stamp":1498317513,
"content":"test4",
"id":76625602,
"user_id":13379,
"user_name":"Michael",
"room_id":1,
"room_name":"Sandbox",
"message_id":37799446,
"message_edits":1
}
],
"t":76625602,
"d":1
}
}Deleted message:
{
"r1":{
"e":[
{
"event_type":10,
"time_stamp":1498317513,
"id":76625609,
"user_id":13379,
"user_name":"Michael",
"room_id":1,
"room_name":"Sandbox",
"message_id":37799446,
"message_edits":1
}
],
"t":76625609,
"d":1
}
}Reply
An event type 18 gets broadcast to all rooms the user is in. But the event type 1 only gets sent to the room the message was posted to.
{
"r1" : {
"e" : [ {
"event_type" : 18,
"time_stamp" : 1500148961,
"content" : "@OakBot Test2",
"id" : 77322110,
"user_id" : 13379,
"target_user_id" : 4258326,
"user_name" : "Michael",
"room_id" : 1,
"room_name" : "Sandbox",
"message_id" : 38145271,
"parent_id" : 38145269,
"show_parent" : true
}, {
"event_type" : 1,
"time_stamp" : 1500148961,
"content" : "@OakBot Test2",
"id" : 77322111,
"user_id" : 13379,
"user_name" : "Michael",
"room_id" : 1,
"room_name" : "Sandbox",
"message_id" : 38145271,
"parent_id" : 38145269,
"show_parent" : true
} ],
"t" : 77322111,
"d" : 2
},
"r139" : {
"e" : [ {
"event_type" : 18,
"time_stamp" : 1500148961,
"content" : "@OakBot Test2",
"id" : 77322110,
"user_id" : 13379,
"target_user_id" : 4258326,
"user_name" : "Michael",
"room_id" : 1,
"room_name" : "Sandbox",
"message_id" : 38145271,
"parent_id" : 38145269,
"show_parent" : true
} ],
"t" : 77322111,
"d" : 2
}
}