websocketutil.js 437 B

123456789101112131415
  1. class WebsocketUtil {
  2. };
  3. WebsocketUtil.ProtectInput = "protectinput";
  4. WebsocketUtil.OpenInput = "openinput";
  5. WebsocketUtil.sendString = function(socket, message) {
  6. socket.sendUTF(JSON.stringify({ type: 'output', data: message}, null, "\t"));
  7. };
  8. WebsocketUtil.sendInstruction = function(socket, instruction) {
  9. socket.sendUTF(JSON.stringify({ type: 'instruction', data: instruction}, null, "\t"));
  10. };
  11. module.exports = WebsocketUtil;