Module: RuneRb::Network::Dispatcher

Included in:
Session
Defined in:
app/network/dispatcher.rb

Overview

Since:

  • 0.9.3

Instance Method Summary collapse

Instance Method Details

#write_message(type, data = {}) ⇒ Object

Writes a Message to the session's socket

Parameters:

  • type (Symbol)

    the type of Message to write

  • data (Hash) (defaults to: {})

    the database that will be included in the message.

Since:

  • 0.9.3


6
7
8
9
10
11
12
# File 'app/network/dispatcher.rb', line 6

def write_message(type, data = {})
  if type == :raw
    write(data[:message], raw: true)
  else
    write(RuneRb::Network::PROTOCOL_TEMPLATES[RuneRb::GLOBAL[:PROTOCOL]][:OUTGOING][type].new(data))
  end
end