locked
websocket connection breaks for larger packets RRS feed

  • Question

  • My websocket server(libwebsocket) sends initial frame of 512 bytes as a response to initial frame form client and then sends continuous stream of large text packets(20kB) to the client.

    IE11 successfully triggers onmessage event on the initial short frame from the server but on the next large text packet it gives

    SCRIPT12152: WebSocket Error: Network Error 12152, The server returned an invalid or unrecognized response

    Safari, Firefox and Chrome are doing good with the server. What can I do to fix it in IE11. And also I couldn't capture websockets traffic in IE11 developer tools.

    http://1drv.ms/1nmLV9B is the link for Wireshark TCP dump between 192.168.0.21(server) and 192.168.0.125(client;ie11)


    • Edited by neckTwi Thursday, June 19, 2014 4:21 PM Information added upon answerer's request
    Wednesday, June 18, 2014 1:15 PM

All replies

  • Hi,

    http://telerik.com/fiddler

    Regards.


    Rob^_^

    Wednesday, June 18, 2014 7:44 PM
  • Can you please share a live repro URL, or a packet capture using Wireshark or NetMon?

    IE11 Developer Tools do not (presently) offer display of WebSocket traffic; Fiddler can display WebSocket traffic from any client (including IE).

    Thursday, June 19, 2014 2:10 PM
  • I've added link to wireshark dump in the question. Thank you!
    Thursday, June 19, 2014 4:22 PM
  • Thanks! This PCAPNG was very helpful.

    In row 8, we see the client send a FinalText frame containing: {path:"/1780",bufferSize:30}

    In row 9, we see the server send a FinalText frame containing a 549 byte string JSON payload ("HuffManTable...")

    In row 11, we see the server send the first 1460 bytes of a string JSON payload ("duration..."). The header promises 8000 bytes in the WebSocket frame.

    In row 13, we see the server send the next 1460 bytes of the payload from #11.

    In row 15, we see the server send the next 1460 bytes of the payload from #11.

    In row 17, we see the server send the next 1460 bytes of the payload from #11. However, very suspiciously, the first bytes of this payload appear to be a WebSocket header for a new 8000 byte continuation frame (0x00, 0x7E, 0x1F, 0x40)

    In row 19, we see the server send the next 1460 bytes of the payload from #11.

    In row 21, we see the server send the next 1460 bytes of the payload from #11. However, very suspiciously, the first bytes of this payload appear to be a WebSocket header for a new 8000 byte continuation frame (0x00, 0x7E, 0x1F, 0x40).

    In row #11, the WebSocket promised that there was 8000 bytes of data in the socket, which means that only the first 704 bytes of the data in row #21 is used to complete the frame. When IE looks at byte 705-708 in row #21, it finds garbage (not an expected websocket header).

    In row #23, we see that the client attempts to FIN the connection to the server, as it has concluded that the server's data is malformed.

    Based on this series of events, my conclusion is that your code has some sort of threading problem where you have multiple overlapping attempts to write frame data to the WebSocket. Because you're using continuation frames, these attempts corrupt the data received by the client.

    Thursday, June 19, 2014 7:06 PM