Webocket question. My server is using CF2021. I...
# cfml-general
d
Webocket question. My server is using CF2021. Is it possible to enable websockets to an app but not declare a channel? I am working on something for a 3rd party app to send WS message to my app but it just connects and sends messages. It doesn't have the ability to subscribe to a channel.
j
Hey @dfgrumpy you have to define at least 1 channel to be able to pub/sub to it.
If you want your 3rd party app to be able to connect to your server’s WebSocket implementation then you might want to look at my HTML to ColdFusion example from my previous presentations. https://github.com/GiancarloGomez/ColdFusion-Realtime-With-WebSockets-Demo-Code/tree/master/html-to-coldfusion
d
Thanks for the info. My issue is that the 3rd party app has no concept of subscribing to a channel (that I can tell). Maybe I can log any WS requests it is making to see what it is trying to do. Is it possible to have CF just log any incoming WS request no matter what it is?
j
You need the specific channel information and object it expects to do anything with what they are sending.
Do you have access to code on the third party app or is it another team?
With info from your app and my example code they should be able to put it all together. If you are going to Into The Box, I can connect with you there and give you a hand. I will be arriving Tuesday evening.
@dfgrumpy and the only way I would know of being able to log anything, is to #1 create the channel for your app and #2 attach a Channel Listener to it, where you can then take action on various events.
d
I have no control over anything the 3rd party app does and their documentation is less than ideal. So I basically just have to "figure it out". I am going to try and use wireshark to see if I can figure out what it is doing.
j
If you have no control over the 3rd party app then how would they be connecting to your WebSocket server?
They would need those details from you in order to make the connection.
d
The only thing I have control over is the WS address and credentials that it points to. Beyond that it just blindly sends data across.
j
Without preparing the connection as required by CF, then you will not be able to do much with what they are sending.