Can I re-register websocket endpoint listener components without restarting Lucee?

As I build my websocket functionality, I occasionally need to re-register my endpoint listener components. However, when I call WebsocketRegister() after it’s been called the first time, I get the following error in my “websocket” log file:

Failed to register endpoint /ws/comments/{channel}: Multiple Endpoints may not be deployed to the same path [/ws/comments/{channel}] : existing endpoint was class net.twentyonesolutions.lucee.websocket.LuceeEndpoint and new endpoint is class net.twentyonesolutions.lucee.websocket.LuceeEndpoint

The only way I know of to re-register my endpoint listener components is to restart Lucee. Is there a better way?

Yes, you can register a new Listener by calling WebsocketRegister() again.

The Java specification for WebSockets, however, does not allow to configure the same endpoint more than once, and that’s why you see that error in the logs.

What the error says is that the endpoint was not registered, but what it doesn’t say is that the new Listener was registered just before that error message was thrown.

I will try to add that to the docs in the future.