Advertisement
Guest User

Untitled

a guest
May 21st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ws = new WebSocket('ws://localhost:3000/cable'); //current server + '/cable'
  2.  
  3. ws.send(JSON.stringify({"command":"subscribe","identifier":'{"channel": "BroadcastChannel","channel_name":"6270fce5-5ed8-4234-8736-2e25d59d086f"}'})); // channel_name - UID юзера
  4.  
  5. table_json = {
  6.   "device_token_name":"helo", // try use what u send on session new as token_name file
  7.   "data_type":"SOCKET_VIEW",
  8.   "tablet_uid":"efe8f483-6b20-45a6-98e1-111a7cf49e89", // TABLET UID
  9.   "status":"INSERT_UPDATE",
  10.   "data": [
  11.     {
  12.       "_description":"",
  13.       "_enabledStatus":0,
  14.       "_id":1,
  15.       "_isAuto":0,
  16.       "_isNormalClose":1,
  17.       "_name":"newr",
  18.       "_operationCode":"4",
  19.       "_operationCodeId":4,
  20.       "_pinId":4,
  21.       "_pinIsInterrupt":1,
  22.       "_pinIsOccupied":1,
  23.       "_pinNumber":03
  24.       }
  25.     ]
  26.   }
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. ws.send(JSON.stringify({"command":"message","identifier":'{"channel": "BroadcastChannel","channel_name":"6270fce5-5ed8-4234-8736-2e25d59d086f"}',"data":JSON.stringify(table_json.data[0])}));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement