Socket.IO

React Native one to one conversation using socket.io

孤人 提交于 2020-12-17 06:17:27
问题 i currently have a react native app with nodejs express Sequelize as my backend and postgres as my database. So, on my posts screen next to each post, i have a text input and a button where the current user can send the user of the post an initial message. Once the button is pressed, a conversation between these 2 users about this post is created in my database and stored in my conversation table and an entry of the message sent is also stored in my messages table. I have implemented

React Native one to one conversation using socket.io

佐手、 提交于 2020-12-17 06:15:08
问题 i currently have a react native app with nodejs express Sequelize as my backend and postgres as my database. So, on my posts screen next to each post, i have a text input and a button where the current user can send the user of the post an initial message. Once the button is pressed, a conversation between these 2 users about this post is created in my database and stored in my conversation table and an entry of the message sent is also stored in my messages table. I have implemented

React Native one to one conversation using socket.io

五迷三道 提交于 2020-12-17 06:13:51
问题 i currently have a react native app with nodejs express Sequelize as my backend and postgres as my database. So, on my posts screen next to each post, i have a text input and a button where the current user can send the user of the post an initial message. Once the button is pressed, a conversation between these 2 users about this post is created in my database and stored in my conversation table and an entry of the message sent is also stored in my messages table. I have implemented

Socket.io double emits when executing express (v4) route

烂漫一生 提交于 2020-12-15 11:15:24
问题 I have a problem with double emits when executing express (v4) route. Lets for example run bellow code. Request (pipe) and mkdir will start immediately (race condition) and there will be error, about that the folder does not exist (mkdir can't create it fast enough, before request is started and start to pipe the data). Cause of this error user is redirected to page X where he need to refill the form. NOW (after redirection with form refilling) everything is working (cause folder do exist on

Socket.io double emits when executing express (v4) route

和自甴很熟 提交于 2020-12-15 11:13:42
问题 I have a problem with double emits when executing express (v4) route. Lets for example run bellow code. Request (pipe) and mkdir will start immediately (race condition) and there will be error, about that the folder does not exist (mkdir can't create it fast enough, before request is started and start to pipe the data). Cause of this error user is redirected to page X where he need to refill the form. NOW (after redirection with form refilling) everything is working (cause folder do exist on

Socket.io double emits when executing express (v4) route

一个人想着一个人 提交于 2020-12-15 11:07:33
问题 I have a problem with double emits when executing express (v4) route. Lets for example run bellow code. Request (pipe) and mkdir will start immediately (race condition) and there will be error, about that the folder does not exist (mkdir can't create it fast enough, before request is started and start to pipe the data). Cause of this error user is redirected to page X where he need to refill the form. NOW (after redirection with form refilling) everything is working (cause folder do exist on

how to Get all connected clients in socket.io

大憨熊 提交于 2020-12-12 05:41:46
问题 I have socket.io v2.3 and I'm trying to get all connected sockets from a different file. Here's my setup: const io = require('socket.io'); let IO; let myNameIO; module.exports = { create: (server) => { IO = io(server, { cors: { origin: '*' } }); const redisConnection = redisAdapter({ host: redisHost, port: redisPort }); IO.adapter(redisConnection); IO.on('connection', (socket) => { console.log('a user connected'); }); IO.on('disconnect', (socket) => { console.log('disconnected'); }); myNameIO

how to Get all connected clients in socket.io

北城以北 提交于 2020-12-12 05:40:11
问题 I have socket.io v2.3 and I'm trying to get all connected sockets from a different file. Here's my setup: const io = require('socket.io'); let IO; let myNameIO; module.exports = { create: (server) => { IO = io(server, { cors: { origin: '*' } }); const redisConnection = redisAdapter({ host: redisHost, port: redisPort }); IO.adapter(redisConnection); IO.on('connection', (socket) => { console.log('a user connected'); }); IO.on('disconnect', (socket) => { console.log('disconnected'); }); myNameIO

Keycloak authentication on socket io

纵然是瞬间 提交于 2020-12-12 02:41:03
问题 I am trying to find out how to authenticate a socket io connection with keycloak. I have used successfully keycloak.protect() function as a middle ware in express, but I am at loss when it comes to socket io. I want something similar to this. app.get("/examples",keycloak.protect(), function(req, res) { res.sendFile(path.join(__dirname, '../production/examples.html')); }); For example to this : io.on('connection', keycloak.protect(), function(socket){ socket.on('disconnect', function(){

Keycloak authentication on socket io

半世苍凉 提交于 2020-12-12 02:40:07
问题 I am trying to find out how to authenticate a socket io connection with keycloak. I have used successfully keycloak.protect() function as a middle ware in express, but I am at loss when it comes to socket io. I want something similar to this. app.get("/examples",keycloak.protect(), function(req, res) { res.sendFile(path.join(__dirname, '../production/examples.html')); }); For example to this : io.on('connection', keycloak.protect(), function(socket){ socket.on('disconnect', function(){