Web Socket Listener
This will connect to and listen on an open web socket server while rocessing any incoming payloads. You may create a web socket listener by using the opus ws-listener CLI command, such as:
apex opus ws-listener <FILENAME>
apex opus ws-listener MyShop/InfuraListener
Using the above example, a new file will be created at /src/MyShop/InfuraListener.php
, and contains one property named $websocket_url
which is the URL of the web socket server to listen to. This class also contains two methods which are described below.
Method | Description |
---|---|
listen() |
Opens a connection to the $websocket_url property, and begins listening for any incoming payloads. |
handle() |
Executed whenever an incoming payload is detected, and handles it as necessary. |