i want use websocket send game info ,
how to setting the LiveQuery Adapter
and how to use Parse.LiveQuery.emit() in js client
i want use websocket send game info ,
how to setting the LiveQuery Adapter
and how to use Parse.LiveQuery.emit() in js client
From the client, the way you have to send data (in your case the game info) is by actually sending a regular api call to create/udpate data in a class. LiveQuery will then broadcast this data to the other clients listening to it.
i know, just like this:
// var q=new Parse.Query(‘player’)
// q.equalTo(‘user_id’,Parse.User.current().id)
// q.subscribe().then(onsub=>{
// onsub.on(‘update’,data=>{
// data.pin().then(()=>{
// Laya.stage.event(’’)
// })
// })
// // 新增
// onsub.on(‘create’,data=>{
// data.pin().then(()=>{
// })
// })
// // 进入
// onsub.on(‘enter’,data=>{
// data.pin().then(()=>{
// })
// })
// // 离开
// onsub.on(‘leave’,data=>{
// data.unPin().then(()=>{
// })
// })
// // åˆ é™¤
// onsub.on(‘delete’,data=>{
// data.unPin().then(()=>{
// })
// })
// },e=>{
// err(e)
// })
But I want to use more websocket,
For example:
websocket.on
websocket.send
websocket.emit
Do you mean that you don’t want to use the SDK? In this case, I suggest you to take a look at the Live Query Spec and he way the Parse SDK implement it.