|
1234567891011121314151617181920212223242526 |
- const io = require('ws');
- const config = require('./config');
-
- function initialWebsocket(onMessage, onError) {
- const socket = new io(
- `ws://127.0.0.1:${config.gatewayPort}/websocket/subscriptionTaskSync`,
- );
-
- socket.on('open', () => {
- // socket.emit("hello", "world");
- console.log('socket connection');
- socket.on('message', onMessage);
- });
- socket.on('error', (...args) => {
- console.log('socket error:', args);
- onError && onError(...args);
- });
- }
-
- module.exports.initialWebsocketEvents = function initialWebsocketEvents(
- onMessage,
- onError,
- ) {
- initialWebsocket(onMessage, onError);
- // ipcMain.handle('socket:on', )
- };
|