class PlaceOS::Api::WebSocket::Session

Defined in:

placeos-rest-api/websocket/session.cr

Constant Summary

Log = ::Log.for(self)

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(ws : HTTP::WebSocket, request_id : String, user : Model::UserJWT, discovery : HoundDog::Discovery = HoundDog::Discovery.new(CORE_NAMESPACE)) #

[View source]

Class Method Detail

def self.binding_key(system_id, module_name, index, name) #

Index into module websocket sessions


[View source]
def self.cache_key(system_id, module_name, index) #

Index into module_id cache


[View source]
def self.subscriptions : Driver::Proxy::Subscriptions #

Class level subscriptions to modules


[View source]

Instance Method Detail

def bind(request_id : Int64, system_id : String, module_name : String, index : Int32, name : String) #

Bind a websocket to a module subscription


[View source]
def cleanup #

Shutdown handler


[View source]
def debug(request_id : Int64, system_id : String, module_name : String, index : Int32, name : String) #

Attach websocket to debug output of a module


[View source]
def delete_binding(system_id, module_name, index, name) #

Create a binding to a module on the Session


[View source]
def exec(request_id : Int64, system_id : String, module_name : String, index : Int32, name : String, args : Array(JSON::Any) | Nil) #

Grab core url for the module and dial an exec request


[View source]
def has_binding?(system_id, module_name, index, name) #

Check for existing binding to a module


[View source]
def ignore(request_id : Int64, system_id : String, module_name : String, index : Int32, name : String) #

Detach websocket from module debug output


[View source]
def metadata?(system_id, module_name, index) : Driver::DriverModel::Metadata | Nil #

Looks up the metadata.

  • checks for fresh value in cache
  • refreshes cache with new value if present

[View source]
def module_id?(system_id, module_name, index) : String | Nil #

Looks up the module_id

  • checks for fresh value in cache
  • refreshes cache with new value if present

[View source]
def notify_update(value, request_id, system_id, module_name, index, status) #

Parse an update from a subscription and pass to listener


[View source]
def parse_request(data) : Request | Nil #

Ensures

  • required params present
  • command recognised

[View source]
def unbind(request_id : Int64, system_id : String, module_name : String, index : Int32, name : String) #

Unbind a websocket from a module subscription


[View source]