Class LibWebSocket::Frame
In: lib/libwebsocket/frame.rb
Parent: Object

Construct or parse a WebSocket frame.

SYNOPSIS

  # Create frame
  frame = LibWebSocket::Frame.new('123')
  frame.to_s # \x00123\xff

  # Parse frames
  frame = LibWebSocket::Frame.new
  frame.append("123\x00foo\xff56\x00bar\xff789")
  frame.next # =>  foo
  frame.next # =>  bar

Methods

append   new   new   next   to_s  

Public Class methods

Public Instance methods

Append a frame chunk. @example

  frame.append("\x00foo")
  frame.append("bar\xff")

Create new frame without modification of current

Return the next frame. @example

  frame.append("\x00foo")
  frame.append("\xff\x00bar\xff")

  frame.next; # =>  foo
  frame.next; # =>  bar

Construct a WebSocket frame. @example

  frame = LibWebSocket::Frame.new('foo')
  frame.to_s # => \x00foo\xff

[Validate]