This class encapsulates all the low-level logic of working with the underlying WebSocket conenctions and delegate all the business-logic to the user-level connection object (e.g., ApplicationCable::Connection). This connection object is also responsible for handling encoding and decoding of messages, so the user-level connection object shouldn’t know about such details.
Methods
- C
- N
- P
- R
- S
- T
Attributes
| [R] | connection | |
| [R] | env | |
| [R] | logger | |
| [R] | protocol | |
| [R] | server |
Class Public methods
new(server, env, coder: ActiveSupport::JSON) Link
# File actioncable/lib/action_cable/server/socket.rb, line 18 def initialize(server, env, coder: ActiveSupport::JSON) @server, @env, @coder = server, env, coder @worker_pool = server.worker_pool @logger = server.new_tagged_logger { request } @websocket = WebSocket.new(env, self, event_loop) @message_buffer = MessageBuffer.new(self) @protocol = nil @connection = config.connection_class.call.new(server, self) end
Instance Public methods
close(...) Link
Close the WebSocket connection.
perform_work(receiver, method, *args) Link
Invoke a method on the connection asynchronously through the pool of thread workers.
request() Link
The request that initiated the WebSocket connection is available here. This gives access to the environment, cookies, etc.