websocket

Can't access Docker container by name in same network

荒凉一梦 提交于 2021-01-29 14:36:00
问题 I've set up a very simple socket communication using the following Java classes: Server.java : public class Server { public static void main(String[] args) throws Exception { try (ServerSocket listener = new ServerSocket(59090)) { while (true) { try (Socket socket = listener.accept()) { Scanner in = new Scanner(socket.getInputStream()); while (in.hasNextLine()) { System.out.println("UPPER CASE: " + in.nextLine().toUpperCase()); } } } } } } Client.java : public class Client { public static

How do you send data to the server onload using ratchet websockets?

☆樱花仙子☆ 提交于 2021-01-29 12:07:02
问题 I have session variables stored on the client. (in this example, session var is "username" with value "Foo") I need the server to know that the new connection that just loaded in has the name "Foo." is there any way to have the server know the value of a session variable? 回答1: No, you cannot do that. Sessions are stored in the cookies and Ratchet cannot access them. However, I use this approach when I am working with web-sockets: Create a hash when the user logins into the account and store

Is global variable assignment atomic on NodeJS?

扶醉桌前 提交于 2021-01-29 11:19:16
问题 I’m working on a stateful and websocket server on Node. We require a piece of read-only data that is important for the biz logic and save it in Node’s global scope, and recently we have to invalidate this require cache and re-require to allow changes of this piece of data at runtime. My question is should we worry simply reassigning the global variable the result of the re-require would cause issues between concurrent connections which read this single copy of data at different phases? Thanks

Kafka: Connector to consume data from websockets and push to topic

牧云@^-^@ 提交于 2021-01-29 09:43:40
问题 We have a data flow pipeline where logs are sent from a websocket endpoint, which need to be pushed to Splunk after doing simple data enhancing (password masking etc). I was checking if Kafka can be used for this because the volumes are really high. So, the possible flow is: Websocket Endpoint --------- some-wss-connector --------> Kafka Topic -------- splunk-connector ----------> Splunk I found the connector for pushing to Splunk at: https://github.com/splunk/kafka-connect-splunk and it

websocket connection timeout on heroku nodejs

天大地大妈咪最大 提交于 2021-01-29 09:31:13
问题 I use npm express-ws for handling websocket request on my express application. On local it works fine. Somehow when I deploy to heroku, it seems to be there is connection timeout every 1 minute of inactivity (no WebSocket request). How to resolve this issue on heroku? 来源: https://stackoverflow.com/questions/61966291/websocket-connection-timeout-on-heroku-nodejs

Python Websockets-8.1 ConnectionClosedError

ぐ巨炮叔叔 提交于 2021-01-29 08:52:00
问题 I want to learn how to properly register and unregister multiple client when using websockets-8.1 as both producer and consumer. The code below, using websockets-8.1 acting as both producer and consumer, throws an exception when a client closes the connection (refreshing or closing the browser window): future: <Task finished coro=<WebSocketCommonProtocol.send() done, defined at .../site-packages/websockets/protocol.py:521> exception=ConnectionClosedError('code = 1006 (connection closed

Unable to subscribe on topic using @stomp/stompjs

柔情痞子 提交于 2021-01-29 08:27:55
问题 Here is a part of my React component: import React from 'react'; import { Client } from '@stomp/stompjs'; class Balance extends React.Component { componentDidMount() { const client = new Client({ brokerURL: 'ws://localhost:8080/stomp', debug: (str) => { console.log(str); }, }); client.onConnect(() => { console.log('onConnect'); client.subscribe('/topic/balance', message => { console.log(message); }) }); client.activate(); } ... It looks like connection was established according to the debug

Socket.io Client close with reason ping timeout

泄露秘密 提交于 2021-01-29 06:47:09
问题 server(node.js) io.on('connection', (socket) => { console.log('user connected'); socket.on('abc', data => { console.log(data); socket.emit('abc', {comment: 'server'}) }); socket.on('disconnect', () => { console.log('user disconnected'); }); socket.on('connect_error', (error) => { console.log(error); }); }); http.listen(3001, () => { console.log('listening on *:3001'); }); client(java) socket = IO.socket("http://gureuso.me"); socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() { @Override

Possible to send audio files through websocket? [closed]

假装没事ソ 提交于 2021-01-29 05:53:34
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago . Improve this question I am building a web application that generates a new audio file depending on the input from the user. The wav file is generated in our python backend and now I want to be able to play it to the user on the frontend. How can I do this with websockets? (which I

Possible to send audio files through websocket? [closed]

好久不见. 提交于 2021-01-29 05:50:20
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago . Improve this question I am building a web application that generates a new audio file depending on the input from the user. The wav file is generated in our python backend and now I want to be able to play it to the user on the frontend. How can I do this with websockets? (which I