LOCKING盒子版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 line
583 B

  1. const io = require('ws');
  2. function initialWebsocket(onMessage) {
  3. const socket = new io('ws://127.0.0.1:7888/websocket/subscriptionTaskSync');
  4. socket.on('open', (socket) => {
  5. // socket.emit("hello", "world");
  6. console.log('socket connection');
  7. socket.on('message', onMessage);
  8. });
  9. socket.on('error', (...args) => {
  10. // socket.emit("hello", "world");
  11. console.log('socket error:', args);
  12. });
  13. }
  14. module.exports.initialWebsocketEvents = function initialWebsocketEvents(
  15. onMessage,
  16. onError,
  17. ) {
  18. initialWebsocket();
  19. // ipcMain.handle('socket:on', )
  20. };