TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.47k stars 2.57k forks source link

Used in Android, unable to connect two flv.js web terminals playing video streams #1342

Closed nciaewlf closed 1 year ago

nciaewlf commented 1 year ago

I use it as a websocket server in Android, but when I use flv.js on the web side to play the video stream (the camera video stream byte on the Android side is encapsulated in flv format), the first web side can play normally, but the second one After the web terminal is connected, onOpen will be called first in the callback, and then onClose will be called to disconnect.

To Reproduce Steps to reproduce the behavior:

  1. import the project and use it for a websocket server
  2. first flv.js on the web side use websocket protocol to play stream from android camera
  3. second flv.js like the first one start on another computer

Example application to reproduce the issue <!DOCTYPE html>

Document

Debug log 07-18 15:53:05.364 D/HStreamTeacherRunnable----(16915): conn.send(data) address: 192.168.20.33, data length: 8599 07-18 15:53:05.365 V/org.java_websocket.WebSocketImpl(16915): 15:53:05.364 [main] TRACE org.java_websocket.WebSocketImpl - send frame: Framedata{ opcode:BINARY, fin:true, rsv1:false, rsv2:false, rsv3:false, payload length:[pos:0, len:8599], payload:(too big to display)} 07-18 15:53:05.365 V/org.java_websocket.drafts.Draft_6455(16915): 15:53:05.365 [main] TRACE org.java_websocket.drafts.Draft_6455 - afterEnconding(8599): too big to display 07-18 15:53:05.365 V/org.java_websocket.WebSocketImpl(16915): 15:53:05.365 [main] TRACE org.java_websocket.WebSocketImpl - write(8603): too big to display 07-18 15:53:05.366 D/HStreamTeacherRunnable----(16915): conn.send(data) address: 192.168.22.32, data length: 8599 07-18 15:53:05.366 V/org.java_websocket.WebSocketImpl(16915): 15:53:05.366 [main] TRACE org.java_websocket.WebSocketImpl - send frame: Framedata{ opcode:BINARY, fin:true, rsv1:false, rsv2:false, rsv3:false, payload length:[pos:0, len:8599], payload:(too big to display)} 07-18 15:53:05.366 V/org.java_websocket.drafts.Draft_6455(16915): 15:53:05.366 [main] TRACE org.java_websocket.drafts.Draft_6455 - afterEnconding(8599): too big to display 07-18 15:53:05.366 V/org.java_websocket.WebSocketImpl(16915): 15:53:05.366 [main] TRACE org.java_websocket.WebSocketImpl - write(8603): too big to display 07-18 15:53:05.373 V/org.java_websocket.WebSocketImpl(16915): 15:53:05.372 [WebSocketWorker-225] TRACE org.java_websocket.WebSocketImpl - process(6): (��<� ) 07-18 15:53:05.373 V/org.java_websocket.drafts.Draft_6455(16915): 15:53:05.373 [WebSocketWorker-225] TRACE org.java_websocket.drafts.Draft_6455 - afterDecoding(2): � 07-18 15:53:05.374 V/org.java_websocket.WebSocketImpl(16915): 15:53:05.373 [WebSocketWorker-225] TRACE org.java_websocket.WebSocketImpl - matched frame: Framedata{ opcode:CLOSING, fin:true, rsv1:false, rsv2:false, rsv3:false, payload length:[pos:0, len:2], payload:�}code: 1000 07-18 15:53:05.374 V/org.java_websocket.WebSocketImpl(16915): 15:53:05.374 [WebSocketWorker-225] TRACE org.java_websocket.WebSocketImpl - send frame: Framedata{ opcode:CLOSING, fin:true, rsv1:false, rsv2:false, rsv3:false, payload length:[pos:0, len:2], payload:�}code: 1000 07-18 15:53:05.374 V/org.java_websocket.drafts.Draft_6455(16915): 15:53:05.374 [WebSocketWorker-225] TRACE org.java_websocket.drafts.Draft_6455 - afterEnconding(2): � 07-18 15:53:05.374 V/org.java_websocket.WebSocketImpl(16915): 15:53:05.374 [WebSocketWorker-225] TRACE org.java_websocket.WebSocketImpl - write(4): �� 07-18 15:53:05.376 D/HWebSocketServer(16915): onClose 192.168.22.32, code: 1000, reason: , remote: true 07-18 15:53:05.376 D/HWebSocketServer(16915): onClose interface: /ch1 07-18 15:53:05.376 D/HWebSocketServer(16915): onClose: 1

Environment(please complete the following information):

marci4 commented 1 year ago

Hello @nciaewlf

Please use the Bug Report template provided at https://raw.githubusercontent.com/TooTallNate/Java-WebSocket/master/.github/ISSUE_TEMPLATE/bug_report.md and do not forget link to the example application!

Without a full bug report this will be closed.

Best regards, marci4

PhilipRoman commented 1 year ago

To clarify - we also need to see the Java part of the application, so that we can reproduce the issue. Currently it seems like flv.js just closes the connection normally.