Files
mixly3/common/modules/mixly-modules/web-socket/socket.js
2024-12-01 14:44:49 +08:00

26 lines
572 B
JavaScript

goog.loadJs('web', () => {
goog.require('io');
goog.require('Mixly.WebSocket');
goog.require('Mixly.WebSocket.Serial');
goog.require('Mixly.WebSocket.ArduShell');
goog.provide('Mixly.WebSocket.Socket');
const { WebSocket } = Mixly;
const { Socket, Serial, ArduShell } = WebSocket;
Socket.init = function () {
const socket = io('wss://127.0.0.1:4000', {
path: '/mixly-socket/',
reconnectionDelayMax: 10000,
transports: ['websocket'],
protocols: ['my-protocol-v1']
});
Serial.init(socket);
ArduShell.init(socket);
}
});