xlui / WebSocketExample

Spring Boot WebSocket Server with Android client and browser client.
https://xlui.me/t/spring-boot-websocket-android-client/
MIT License
61 stars 25 forks source link

Android Client Produces java.io.EOFException #1

Open xlui opened 6 years ago

xlui commented 6 years ago

Using okhttp WebSocket as a stomp client will throws an error after about 1 min of inactivity.

java.lang.Exception: java.io.EOFException

This is because that StompProtocolAndroid have not implement heart beat on creating connections, so we have to implement it by ourselves.

Here is an example:

// code to set a scheduled task, I'm sorry for ignoring this part, but I don't know how to do this.
stompClient.send("", "")subscribe();   // send a heart beat
xlui commented 6 years ago

This issue is used to show how to solve the EOFException.

lulicheng commented 5 years ago

Good job!