     @socket = null
     
     # Holds buffered data
-    @buffer = new ByteBuffer(0)
+    @buffer = new ByteBuffer()
     
     # Holds (partial) packet (if any) and its remaining size in bytes
     @packet = null

        @on.disconnect.dispatch(@, e)
      
      @socket.onmessage = (e) =>
        @buffer = ByteBuffer.join(@buffer, e.data)
        @on.dataReceive.dispatch(@)
      
      @socket.onerror = (e) ->

  send: (packet) ->
    if @connected
      
      console.log '⟸', packet
      
      packet.finalize()
      
      console.log packet.toString()
      console.log packet.toHex()
      console.log packet.toASCII()
      
      @socket.send(packet.buffer)
      
