R
R
rockwell3232021-05-01 16:37:23
IntelliJ IDEA
rockwell323, 2021-05-01 16:37:23

How to properly connect to websocket via socket.io-client?

I want to connect to a websocket of a third-party site, the connection occurs, but since I can’t figure out how to add namespace: 'App.Info' and subscribe to the 'db.list' channel and listen to the 'ResponseData' event, nothing happens.
Mb someone will help what and how in these web sockets)

const io = require("socket.io-client"); // v2.3.1

const socket = io('wss://example:2020');

socket.on('connect', () => {
    console.log('connect'); // connect
    console.log(socket.id); // uS4yrcsOEqxZ3kMqEVyB

    socket.send(JSON.stringify({'namespace': 'App.Info'}));

    socket.emit('db.list');
});

socket.on('ResponseData', data => {
    console.log(data);
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zasik, 2018-09-23
@zasik

We go into the editor, press Ctrl + Alt + S. Then Edito->General->Code Completion. And under the chapter Parameter info uncheck "Show parameter info popup in".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question