Welcome to the Finch WebSocket Guide! This guide will walk you through the steps to use WebSocket in your Finch application. Whether you're a seasoned developer or just starting, Finch offers a robust set of tools to simplify server-side web app development.
Using WebSocket in Finch
For defining WebSocket for your Finch application, you need to use the SocketManager class. The SocketManager class is used to manage WebSocket connections in your Finch application. It contains all the necessary properties to manage WebSocket connections. and then you can use the addSocketRoute method to add your WebSocket routes to your Finch application. after that you can use the socketController to handle the WebSocket connection.
SocketManager
The SocketManager class is used to manage WebSocket connections in your Finch application. It contains all the necessary properties to manage WebSocket connections. Here is an example of how to use it:
The SocketEvent class is used to define the events that can be triggered in a WebSocket connection. It contains all the necessary properties to define the events. Here is an example of how to use it:
WebSocket routes are defined in the getSocketRoute function. This function returns a Map<String, SocketEvent> that contains all the WebSocket routes. Here is an example of how to use it:
Adding your socket routes to FinchApp
getSocketRoute() is a function that returns a Map<String, SocketEvent>. You can add it to your FinchApp instance by using the addSocketRoute method. Here is an example of how to use it: