WebsockexAdapter.MessageHandler (WebsockexAdapter v0.1.1)

View Source

Message handling utilities for WebSocket connections.

  • Parse incoming WebSocket frames and Gun messages
  • Route messages to user-provided handler functions
  • Handle control frames (ping/pong) automatically
  • Process WebSocket upgrade responses

Summary

Functions

Create a callback function for handling specific message types.

Default message handler that simply logs messages.

Handle WebSocket control frames automatically. Returns :handled for control frames, :not_control for data frames.

Handle incoming Gun messages and WebSocket frames. Routes messages to appropriate handler function.

Functions

create_handler(opts \\ [])

Create a callback function for handling specific message types.

default_handler(message)

Default message handler that simply logs messages.

handle_control_frame(arg1, conn_pid, stream_ref)

Handle WebSocket control frames automatically. Returns :handled for control frames, :not_control for data frames.

handle_message(message, handler_fun \\ &default_handler/1)

Handle incoming Gun messages and WebSocket frames. Routes messages to appropriate handler function.