Class: Riddl::WebSocketImplementation

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/riddl/implementation.rb

Direct Known Subclasses

Utils::Notifications::Producer::WS

Instance Method Summary collapse

Constructor Details

#initialize(ws) ⇒ WebSocketImplementation

Returns a new instance of WebSocketImplementation.



29
30
31
32
33
34
35
36
# File 'lib/ruby/riddl/implementation.rb', line 29

def initialize(ws)
  @ws    = ws
  @r     = ws[:r]     # the matching resource path
  @s     = ws[:s]     # the matching resource path schema
  @match = ws[:match] # the path of the branch matching, important for recursive
  @env   = ws[:env]   # environment (all headers)
  @a     = ws[:a]     # args to run command
end

Instance Method Details

#closeObject



57
58
59
# File 'lib/ruby/riddl/implementation.rb', line 57

def close
  p @ws[:io].class
end

#closed?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/ruby/riddl/implementation.rb', line 53

def closed?
  @ws[:io].closed?
end

#ioObject



50
51
52
# File 'lib/ruby/riddl/implementation.rb', line 50

def io
  @ws[:io]
end

#io=(connection) ⇒ Object



47
48
49
# File 'lib/ruby/riddl/implementation.rb', line 47

def io=(connection)
  @ws[:io] = connection
end

#oncloseObject



39
# File 'lib/ruby/riddl/implementation.rb', line 39

def onclose;end

#onerror(err) ⇒ Object



41
# File 'lib/ruby/riddl/implementation.rb', line 41

def onerror(err);end

#onmessageObject



40
# File 'lib/ruby/riddl/implementation.rb', line 40

def onmessage;end

#onopenObject



38
# File 'lib/ruby/riddl/implementation.rb', line 38

def onopen;end

#send(data) ⇒ Object



43
44
45
# File 'lib/ruby/riddl/implementation.rb', line 43

def send(data)
  self.io.send data
end