Questions tagged [Socket.io] (507)

1
answer

Can't get the object in another file?

I'm trying to access the socket instance from another file socket.js const IO = require( 'koa-socket-2' ); const io = new IO(); module.exports = { io } service.jsconst io = require('./../socket').io; console.log(io); // undefined Why can't I get this object?
Kaitlin47 asked March 30th 20 at 01:31
1
answer

How to connect to a socket.io?

There is a simple chat server which works fine var express = require('express'); var socket = require('socket.io'); var app = express(); server = app.listen(5000,console.log('server is running on port 3000')); io = socket(server); io.on('connection', (socket) => { let currentRoom = 'data' socket.join(currentRoom ) // l...
Bella99 asked March 30th 20 at 00:51
1
answer

How to use an instance of socket.io in controllers Node.js?

If I want to use the socket instance.io controller, global.io = io absolutely awful? If Yes, then how can I reach the io on another of their controllers? index.jsconst server = app.listen(3000, '127.0.0.1', () => { console.log("Node.js listening on port 3000"); }); // socket const io = require('socket.io')(server); con...
ayla8 asked March 30th 20 at 00:31
1
answer

How to connect a client socket.io?

So describes the client connection to the socket server in the documentation, but I'm not comfortable with In the query string, write https://domain.ru:9081 In HTML, the document stated<script src="/socket.io/socket.io.js"></script> the <script> $(function () { var socket = io.connect('https://domain.ru:...
sonia_Howell asked March 30th 20 at 00:17
0
answer

How to run socket.io on WS[WSS] proxied to another server?

The server mysite.com Running nginx version == 1.16.0. Link mysite.com/app proximedia on mysite-srv.com:30001. On mysite-srv.com run nodejs app on and socket.io port == 30001. The client connects to mysite.com/app - all works. Nginx configuration:The nginx configurationserver { ... location /app/ { proxy_pass http://my...
kris.Fisher asked March 29th 20 at 20:57
0
answer

How to connect to a socket.io server?

Good day, trying to connect to a socket (as a client) nothing happens. How to know the connection status? The resulting path, after connecting on the website in the browser: wss://....com/app1socket/?EIO=3&transport=websocket&sid=... Previously seen only this: wss://....com/socket.io/?EIO=3&transport=websocket&a...
arno_Raynor asked March 29th 20 at 20:46
1
answer

How to configure Socket.IO?

Good day! How to configure socket In nodejs I have created a https server and gave a different portconst app = express() const server = http.createServer(app); const options = { key: fs.readFileSync('./cert/c.key'), cert: fs.readFileSync('./cert/c.crt'), requestCert: true, rejectUnauthorized: false, } const httpsServe...
Vincent_Heidenreich asked March 29th 20 at 20:12
1
answer

How can I sync Socket.io to all devices?

How can I sync Socket.io to all devices the user? Authorization is built on jwt token. The assumption is: once on the client I can operate only by jwt token, then it would be reasonable to create room with same ID and do emit this token to the server in which to push it into an object like: { userid: { token, timestamp,}, u...
alayna.Reich asked March 29th 20 at 20:05
2
answers

Is it permissible when using socket.io HTTP requests?

For training purposes develop an application for tracking athletic performance. Use the socket library.io to get the message about the change of the result from the server. Want to add a registration and authorization. The question arose, how all it competently to make? Would it be correct to register to use post requests, ...
rowena.Spinka21 asked March 29th 20 at 19:49
3
answers

How to implement a realtime app?

Hello! Please tell me how to implement dynamic update table from another user when you change. If I edit from himself, then the fields of the table are added to and removed jet. But another employee has to refresh the page. I read that you can implement with socket.io... but there is the principle message, and how to implem...
blair.Jaco asked March 29th 20 at 19:37