Websocket returns empty message

Just checking to make sure Websockets is suppose to return an empty message when it finishes. From the docs, one should use wsclient.send() to send a message. But I am seeing a empty message being returned even after using send.

So far onMessage() return empty strings.

I assume the alternate way around this is to return the message instead of using wsclient.send()?

Do you have an example of the code you are using?

The wsclient class that gets passed back from the OnOpen, OnMessage, etc functions (and is included in the array from the onFirstOpen function, has a send(message) function that you would call. That will send the string to the client represented in that connection.

The onMessage(message) will pass in the argument to your function with whatever the connected browser sent in.

I’ve found the communication going back and forth to be pretty reliable – and I’m using the latest WebSocket Extension that’s published on the downloads page…

Sure, it is mostly from the example (this is the websocket.cfc part of onMessage():

function onMessage( wsclient, message )
    {
        wsclient.send('received');
    }

It returns received
then <empty string>

I added more complex code into it, but it has done it since I began coding websockets. I can stop it by returning an empty struct at the end of the block.

function onMessage( wsclient, message )
    {
        wsclient.send('received');
        return {};
    }

But I am pretty sure the javascript onmessage() is just ignoring it because it is not a string, and that is not a proper solution. And if you want the full websocket.cfc it literally is a copy paste from the example code.

Sorry, I forgot I am in a new thread and not a continuation of another thread.

I am running Lucee 7 with snapshot 3.0.0.20 of websockets. The “published” version is broken for Lucee 7 and Zackster has told me to use the recent snapshot.