Skip to main content

Channel Routes

Introduction to Channel Routes

API routes in Vramework serve as the entry points for handling Channels (as of now this is just websockets). When a request is made, an API route listens on the specified path and processes the request by calling a function. The process involves:

  • Extracting the session (if possible)
  • Calling the onConnection method (if available)
  • Routing messages recieved to the approtatie function
  • Calling the onDisconnection method (if available)

Defining API Routes

An channel route is a configuration object that defines the behavior for a specific channel request. Here is an example that demonstrates setting up routes for fetching and updating a book:

events.channel.ts
loading...