websocket

Can websocket messages get lost or not?

心不动则不痛 提交于 2021-02-06 15:47:18
问题 I'm currently developing a Java WebSocket Client Application and I have to make sure that every message from the server is received by the client. Is it possible that I lose some messages (once they are sent from the server) due to a connection interruption? WebSocket is based on TCP so this shouldn't happen right? 回答1: It can happen. TCP guarantees the order of packets, but it does not mean that all packets sent from a server reach a client even when an unrecoverable trouble happens in an

Websocket Client Could not find an implementation class

北城余情 提交于 2021-02-06 15:24:06
问题 I will preface this with I am not using any maven dependencies, yet I know that I am missing a jar file wls-api.jar (at least that is what I have read). To remedy this I downloaded the oracle-weblogic-7.9.jar but the problem persists. The exception is thrown at this line WebSocketContainer container = ContainerProvider.getWebSocketContainer(); Can anyone tell me why this line continuously fails? UPDATE: upon further reading the examples I see use this dependency <dependency> <groupId>javax

WebSocket: OnClose() is never called

谁都会走 提交于 2021-02-06 15:24:02
问题 I'm implementing an application with a WebSocket endpoint. Here is some code: @ApplicationScoped @ServerEndpoint(value="/socket", encoders = {MessageEncoder.class, CommandEncoder.class}) public class SocketEndpoint { /** Default-Logger */ private final static Logger LOG = LoggerFactory.getLogger(SocketEndpoint.class); @Inject SessionHandler sessionHandler; @OnOpen public void open(Session session, EndpointConfig config) { LOG.debug("Connected session => '{}' - '{}'", session, config);

Websocket Client Could not find an implementation class

允我心安 提交于 2021-02-06 15:23:22
问题 I will preface this with I am not using any maven dependencies, yet I know that I am missing a jar file wls-api.jar (at least that is what I have read). To remedy this I downloaded the oracle-weblogic-7.9.jar but the problem persists. The exception is thrown at this line WebSocketContainer container = ContainerProvider.getWebSocketContainer(); Can anyone tell me why this line continuously fails? UPDATE: upon further reading the examples I see use this dependency <dependency> <groupId>javax

Real time notification with Kafka and NodeJS

时间秒杀一切 提交于 2021-02-06 12:56:12
问题 In my project, I have to design a real time notification system. And I did it as the image below. You can see that I used Kafka as a queue messaging system, and NodeJS to build Websocket Server and Kafka Consumers. Producers will collect the notification data and push it to Kafka. Consumers will read and process the data from Kafka and push it to client via websocket if that data belongs to that user. With the architect above, Each online user will open a Websocket connection and create a new

Websocket Security

旧城冷巷雨未停 提交于 2021-02-05 20:48:17
问题 I am looking to implement web (angular) and iPhone apps using WebSockets to communicate with our server. In the past using HTTP requests we have used hashes using the request data, url, timestamp etc to authenticate and secure the requests. As far as I am aware we can't send headers with WebSockets requests therefore I am wondering how I can secure each request. Does anyone have any ideas or good practices? 回答1: Having secure communication with server includes authenticating both parties to

Socket.io chat app that can also send image and even file

我怕爱的太早我们不能终老 提交于 2021-02-05 20:31:50
问题 I've been interested in the Socket.io project recently and I wonder if there's easy way to send image or even other type of files without having to use other library. I'm not trying to upload the file to the server to store, I just want to broadcast it to those who are in the chat room at that moment. So the code should be minimal. However I'm really bad at encoding/decoding stuff, so some example code would be great. 回答1: I've adapted the official chat example of Socket.io and added

Socket.io chat app that can also send image and even file

妖精的绣舞 提交于 2021-02-05 20:30:29
问题 I've been interested in the Socket.io project recently and I wonder if there's easy way to send image or even other type of files without having to use other library. I'm not trying to upload the file to the server to store, I just want to broadcast it to those who are in the chat room at that moment. So the code should be minimal. However I'm really bad at encoding/decoding stuff, so some example code would be great. 回答1: I've adapted the official chat example of Socket.io and added

IE10 websocket allowInsecureFromHttps

[亡魂溺海] 提交于 2021-02-05 20:15:34
问题 I've got a websocket implementation that I'm trying to make work across browsers . At some point, we'll migrate to wss:// (i.e. encrypted websockets) but for now, it's all ws://. When we serve a page from https that redirects to a ws host, we see the following: Chrome is okay. Firefox is okay if the allowInsecureFromHttps setting is set to true. IE10 barfs. I know that the correct path is to simply implement wss, but in the meantime, I'm wondering if there's any configuration I can apply to

Websocket, Angular 2 and JSON Web token Authentication

左心房为你撑大大i 提交于 2021-02-05 15:42:36
问题 My Angular 2 app (coded in typescript) has a simple authentication scheme: User logs in: Server returns JSON Web Token (JWT) abc123... On every API call, the app sends the JWT in the Authorization header Server validates the JWT and grants access Now I'd like to add websockets. I'm wondering how to authenticate the user there. Since I don't control which headers are sent to the websocket server (WS), I cannot send the JWT. My idea so far (not yet implemented): Client opens websocket: let sock