Socket.IO

Listening socket.io events and updating LiveData (a class of android.arch.lifecycle)in application class android

主宰稳场 提交于 2021-02-18 19:10:28
问题 I am working on a chat application and Currently I am listening and emitting socket events in an Activity. Now i want to listen all the socket events even when chat activity is not in foreground as i want to store all the messages from different users in the local DB at the same time i want to update LiveData to update UI. In order to achieve this I am listening socket events in the Application class as following: public class ChatApplication extends Application { public Socket mSocket;

Listening socket.io events and updating LiveData (a class of android.arch.lifecycle)in application class android

只谈情不闲聊 提交于 2021-02-18 19:09:57
问题 I am working on a chat application and Currently I am listening and emitting socket events in an Activity. Now i want to listen all the socket events even when chat activity is not in foreground as i want to store all the messages from different users in the local DB at the same time i want to update LiveData to update UI. In order to achieve this I am listening socket events in the Application class as following: public class ChatApplication extends Application { public Socket mSocket;

Listening socket.io events and updating LiveData (a class of android.arch.lifecycle)in application class android

早过忘川 提交于 2021-02-18 19:08:53
问题 I am working on a chat application and Currently I am listening and emitting socket events in an Activity. Now i want to listen all the socket events even when chat activity is not in foreground as i want to store all the messages from different users in the local DB at the same time i want to update LiveData to update UI. In order to achieve this I am listening socket events in the Application class as following: public class ChatApplication extends Application { public Socket mSocket;

Flask Docker container SocketIO Issues

纵饮孤独 提交于 2021-02-18 12:18:06
问题 I have a Flask application that uses SocketIO to fetch data from Postgres live. The app works fine when I run this locally. The problem arouses when I use docker-compose to host my Flask app. My JS client and flask server is hosted into a single app and on the same container. My socketio in JS is like this: var socket = io().connect(window.location.protocol + '//' + document.domain + ':' + location.port); Dockerfile: # Using python 3.7 in Alpine FROM python:3.6.5-stretch # Set the working

Update React state via Socket.io

自作多情 提交于 2021-02-18 06:58:36
问题 My React component uses data from socket.io as it's state. I am unsure how to just update the state when the data is updated without re-rendering the entire component. Example code. var socket = io(); var data = { components: [{key: '',name: '',markup: ''}] }; socket.on('data', function(_) { data = _; }); var Components = React.createClass({ displayName: "Components", getInitialState: function getInitialState() { return data; }, handleChange: function handleChange() { this.setState(data); },

Deploying a TCP server to Heroku

≡放荡痞女 提交于 2021-02-18 03:02:04
问题 I have a TCP server coded in node.js. I'd like to put it up on Heroku because it's a free service and I don't need anything more than what their free plan offers. Now, I know very little about the inner workings of Heroku and I'm pretty new to the whole thing so I have a few questions. Firstly, is it even possible to deploy a TCP (non-web) server? I've read that Heroku doesn't like node.js's net because it doesn't support websockets and that I should use socket.io. So I've switched my server

Deploying a TCP server to Heroku

流过昼夜 提交于 2021-02-18 03:01:13
问题 I have a TCP server coded in node.js. I'd like to put it up on Heroku because it's a free service and I don't need anything more than what their free plan offers. Now, I know very little about the inner workings of Heroku and I'm pretty new to the whole thing so I have a few questions. Firstly, is it even possible to deploy a TCP (non-web) server? I've read that Heroku doesn't like node.js's net because it doesn't support websockets and that I should use socket.io. So I've switched my server

Socket.IO: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

断了今生、忘了曾经 提交于 2021-02-17 05:27:08
问题 I have a strange issue in FF which is not reproduced in Chrome: websocket connection to another origin does not work when using SSL connection. My Rails app is running on https://wax.lvh.me:3000 and socket.io node JS app is running on https://wax.lvh.me:3001 . When I try to connect to the socket from the Rails app in FF I see the following warnings in the browser's dev console: When I open the Network tab I see the following response headers - notice that there are no access-control headers

SockJS connected as websocket, but nothing going through

喜欢而已 提交于 2021-02-11 18:04:16
问题 I came accross a problem while using SockJS on a specific access network. It think it is related to the way SockJS chooses the best transport protocol (websocket, long polling, ...) according to the state of the network. Using a web browser, my SockJS client is connected with the websocket transport protocol to my node SockJS server. I even see the "on connection" event on node. However, when I send data, nothing passes through it. To be exhaustive, it works perfectly well from some other

Node.js, socket-io based one to one chat engine working fine on LOCAL but not working when running on different laptops using ngrok

回眸只為那壹抹淺笑 提交于 2021-02-11 16:39:29
问题 I am working on a chat server and it's working fine on local but whenever I try to run the project using ngrok then me and my friend are unable to chat. var socket = io('http://localhost:7777', { query: { username: '<%= user %>' } }); Can anyone guide me how to make this public? Because the IP address changes everytime when connected to internet. and var app = express(); const chatServer = require('http').createServer(app); chatServer.listen(7777); I'm working in node.js for the first time