def send_message data, binary=false
      if established?
        unless @closing
          @socket.send_data(@encoder.encode(data.to_s, binary ? BINARY_FRAME : TEXT_FRAME))
        end
      else
        raise WebSocketError.new "can't send on a closed channel"
      end
    end
def send_message data, binary=false
      if established?
        unless @closing
          @socket.send_data(@encoder.encode(data.to_s, binary ? BINARY_FRAME : TEXT_FRAME))
        end
      else
        raise WebSocketError.new "can't send on a closed channel"
      end
    end
Send a message to the remote host

 data - The string contents of your message

 Examples

   ws.onping do |data|
   end

 Returns nothing