Class: WebSocket::Frame::Outgoing

### Home Classes Methods

### In Files

- lib/websocket/frame/outgoing.rb
- lib/websocket/frame/outgoing/client.rb
- lib/websocket/frame/outgoing/server.rb

### Parent

WebSocket::Frame::Base

### Namespace

- CLASS WebSocket::Frame::Outgoing::Client
- CLASS WebSocket::Frame::Outgoing::Server

### Methods

- #require_sending?
- #supported?
- #to_s

### Class/Module Index

Quicksearch

- WebSocket
- WebSocket::Error
- WebSocket::Error::Frame
- WebSocket::Error::Frame::ControlFramePayloadTooLong
- WebSocket::Error::Frame::DataFrameInsteadContinuation
- WebSocket::Error::Frame::FragmentedControlFrame
- WebSocket::Error::Frame::Invalid
- WebSocket::Error::Frame::InvalidPayloadEncoding
- WebSocket::Error::Frame::MaskTooShort
- WebSocket::Error::Frame::ReservedBitUsed
- WebSocket::Error::Frame::TooLong
- WebSocket::Error::Frame::UnexpectedContinuationFrame
- WebSocket::Error::Frame::UnknownCloseCode
- WebSocket::Error::Frame::UnknownFrameType
- WebSocket::Error::Frame::UnknownOpcode
- WebSocket::Error::Frame::UnknownVersion
- WebSocket::Error::Handshake
- WebSocket::Error::Handshake::GetRequestRequired
- WebSocket::Error::Handshake::InvalidAuthentication
- WebSocket::Error::Handshake::InvalidHeader
- WebSocket::Error::Handshake::InvalidStatusCode
- WebSocket::Error::Handshake::NoHostProvided
- WebSocket::Error::Handshake::UnknownVersion
- WebSocket::ExceptionHandler
- WebSocket::ExceptionHandler::ClassMethods
- WebSocket::Frame
- WebSocket::Frame::Base
- WebSocket::Frame::Data
- WebSocket::Frame::Handler
- WebSocket::Frame::Handler::Base
- WebSocket::Frame::Handler::Handler03
- WebSocket::Frame::Handler::Handler04
- WebSocket::Frame::Handler::Handler05
- WebSocket::Frame::Handler::Handler07
- WebSocket::Frame::Handler::Handler75
- WebSocket::Frame::Incoming
- WebSocket::Frame::Incoming::Client
- WebSocket::Frame::Incoming::Server
- WebSocket::Frame::Outgoing
- WebSocket::Frame::Outgoing::Client
- WebSocket::Frame::Outgoing::Server
- WebSocket::Handshake
- WebSocket::Handshake::Base
- WebSocket::Handshake::Client
- WebSocket::Handshake::Handler
- WebSocket::Handshake::Handler::Base
- WebSocket::Handshake::Handler::Client
- WebSocket::Handshake::Handler::Client01
- WebSocket::Handshake::Handler::Client04
- WebSocket::Handshake::Handler::Client11
- WebSocket::Handshake::Handler::Client75
- WebSocket::Handshake::Handler::Client76
- WebSocket::Handshake::Handler::Server
- WebSocket::Handshake::Handler::Server04
- WebSocket::Handshake::Handler::Server75
- WebSocket::Handshake::Handler::Server76
- WebSocket::Handshake::Server

No matching classes.

# WebSocket::Frame::Outgoing

Construct or parse incoming WebSocket Frame. @note You should NEVER use this class directly - use Client or Server subclasses instead, as they contain additional frame options(i.e. Client-side masking in draft 04)

@example

    frame = WebSocket::Frame::Outgoing::Server.new(version: @handshake.version, data: "Hello", type: :text)
    frame.to_s # "\x81\x05\x48\x65\x6c\x6c\x6f"

### Public Instance Methods

require_sending?() click to toggle source

Should current frame be sent? Exclude empty frames etc. @return [Boolean] true if frame should be sent

    # File lib/websocket/frame/outgoing.rb, line 22
    def require_sending?
      !error?
    end

supported?() click to toggle source

Is selected type supported by current draft version? @return [Boolean] true if frame type is supported

    # File lib/websocket/frame/outgoing.rb, line 16
    def supported?
      support_type?
    end

to_s() click to toggle source

Return raw frame formatted for sending.

    # File lib/websocket/frame/outgoing.rb, line 27
    def to_s
      raise WebSocket::Error::Frame::UnknownFrameType unless supported?
      @handler.encode_frame
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.