Socket.IO

Custom Events in Node.js with Express framework

a 夏天 提交于 2020-12-28 07:43:15
问题 So, I'd like to know how to create custom events in node.js, and I'm hitting a wall. I'm pretty sure I'm misunderstanding something about how express works and how node.js events work. https://creativespace.nodejitsu.com That's the app. When a user creates a new "activity" (something that will happen many times) they send a POST request. Then within my route, if that POST succeeds I'd like to emit an event, that tells socket.io to create a new namespace for that activity. In my route file:

Custom Events in Node.js with Express framework

不羁的心 提交于 2020-12-28 07:42:40
问题 So, I'd like to know how to create custom events in node.js, and I'm hitting a wall. I'm pretty sure I'm misunderstanding something about how express works and how node.js events work. https://creativespace.nodejitsu.com That's the app. When a user creates a new "activity" (something that will happen many times) they send a POST request. Then within my route, if that POST succeeds I'd like to emit an event, that tells socket.io to create a new namespace for that activity. In my route file:

Custom Events in Node.js with Express framework

…衆ロ難τιáo~ 提交于 2020-12-28 07:42:04
问题 So, I'd like to know how to create custom events in node.js, and I'm hitting a wall. I'm pretty sure I'm misunderstanding something about how express works and how node.js events work. https://creativespace.nodejitsu.com That's the app. When a user creates a new "activity" (something that will happen many times) they send a POST request. Then within my route, if that POST succeeds I'd like to emit an event, that tells socket.io to create a new namespace for that activity. In my route file:

Socket io CORS blocked

微笑、不失礼 提交于 2020-12-27 05:58:52
问题 i got this warning when using https domain and https socket io. Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://iosocket.transys.id:30005/socket.io/?EIO=3&transport=polling&t=McZQ-hN. (Reason: CORS request did not succeed). my code is like this: var socket = require( 'socket.io' ); var express = require('express'); var app = express(); var server = require('http').createServer(app); var io = socket.listen( server); var port = process.env

Socket io CORS blocked

六月ゝ 毕业季﹏ 提交于 2020-12-27 05:57:34
问题 i got this warning when using https domain and https socket io. Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://iosocket.transys.id:30005/socket.io/?EIO=3&transport=polling&t=McZQ-hN. (Reason: CORS request did not succeed). my code is like this: var socket = require( 'socket.io' ); var express = require('express'); var app = express(); var server = require('http').createServer(app); var io = socket.listen( server); var port = process.env

Strange react-native state behaviour while using socket io

删除回忆录丶 提交于 2020-12-26 05:02:20
问题 Hi currently im trying to create a simple group chat apps. when i use this on useEffect useEffect(() => { // i want to fetch data from the backend first and concat it with the msg that will be send during the chat handleGetGroupMessage(); let socket = io(socketUrl); socket.on("GroupChat", (msg) => { console.log("this is the chat messages", chatMessages); setChatMessages(chatMessages.concat(msg)); }); }, []); when the apps is loaded all the messages from my backend was stored in that state.

Strange react-native state behaviour while using socket io

折月煮酒 提交于 2020-12-26 05:01:44
问题 Hi currently im trying to create a simple group chat apps. when i use this on useEffect useEffect(() => { // i want to fetch data from the backend first and concat it with the msg that will be send during the chat handleGetGroupMessage(); let socket = io(socketUrl); socket.on("GroupChat", (msg) => { console.log("this is the chat messages", chatMessages); setChatMessages(chatMessages.concat(msg)); }); }, []); when the apps is loaded all the messages from my backend was stored in that state.

Strange react-native state behaviour while using socket io

我只是一个虾纸丫 提交于 2020-12-26 05:01:11
问题 Hi currently im trying to create a simple group chat apps. when i use this on useEffect useEffect(() => { // i want to fetch data from the backend first and concat it with the msg that will be send during the chat handleGetGroupMessage(); let socket = io(socketUrl); socket.on("GroupChat", (msg) => { console.log("this is the chat messages", chatMessages); setChatMessages(chatMessages.concat(msg)); }); }, []); when the apps is loaded all the messages from my backend was stored in that state.

Strange react-native state behaviour while using socket io

最后都变了- 提交于 2020-12-26 05:01:04
问题 Hi currently im trying to create a simple group chat apps. when i use this on useEffect useEffect(() => { // i want to fetch data from the backend first and concat it with the msg that will be send during the chat handleGetGroupMessage(); let socket = io(socketUrl); socket.on("GroupChat", (msg) => { console.log("this is the chat messages", chatMessages); setChatMessages(chatMessages.concat(msg)); }); }, []); when the apps is loaded all the messages from my backend was stored in that state.

UseEffect hook with socket.io state is not persistent in socket handlers

吃可爱长大的小学妹 提交于 2020-12-23 00:50:11
问题 I have the following react component function ConferencingRoom() { const [participants, setParticipants] = useState({}) console.log('Participants -> ', participants) useEffect(() => { // messages handlers socket.on('message', message => { console.log('Message received: ' + message.event) switch (message.event) { case 'newParticipantArrived': receiveVideo(message.userid, message.username) break case 'existingParticipants': onExistingParticipants( message.userid, message.existingUsers ) break