This project is read-only.

Out of range exception

Sep 27, 2012 at 8:17 AM

I have tested your code without introducing any modification to its source.

I connect to the websocket server with the following html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
    <script type="text/javascript">
        var socket = new WebSocket('ws://localhost:8181/');
        socket.onopen = function() {
            alert('handshake successfully established. May send data now...');
        socket.onerror = function(msg) {
            alert('connection error:' +;
        socket.onclose = function() {
            alert('connection closed');
        socket.onmessage = function(msg) {
            alert('msg: ' +;


I get an exception due to an out of range exception when calling

            ArraySegment<byte> challenge = new ArraySegment<byte>(byteShake.Array, byteShake.Count - 8, 8); // -8 : eight byte challenge

I am using Firefox 15.0.1.

Is this a known issue?

Oct 10, 2012 at 12:57 PM

The error is happening because the server is not up to date with the current protocol.

I have made a new branch (rfc6455) where i have updated the server according to the new protocol. It is not very elegant as it is (which is why i haven't merged it into the default branch), but i works on my box so it might also work on yours.