This is more of a question than an issue. What I am looking to do is get the names of all currently connected clients. I have the code below:
var chanId = arguments.websocket.getPathParameters().channel;
var connMgr = arguments.websocket.getConnectionManager();
var currentSubscribers = ArrayMap(connMgr.getChannel(chanId).getSubscribers().toArray(), function(subscriber) {
return arguments.subscriber.getSessionScope().user.label;
});
This seems to do what I want because inside the sessionScope is a user struct that contains the name of the user. Is there a better way to accomplish the same thing?
Another thing I was wondering about is that if I put the above code in the (onClose, onUnsubscribe) functions and I have two users connected to a channel and I navigate one user away it will still show the user that navigated away in the array returned. Maybe I am doing something wrong. Thanks in advance for any help and creating such a great extension!
Can you please post your question at https://dev.lucee.org/ so that it may benefit others with similar questions in the future? I will look at it as soon as I can. Thanks!
This is more of a question than an issue. What I am looking to do is get the names of all currently connected clients. I have the code below:
This seems to do what I want because inside the sessionScope is a user struct that contains the name of the user. Is there a better way to accomplish the same thing?
Another thing I was wondering about is that if I put the above code in the (onClose, onUnsubscribe) functions and I have two users connected to a channel and I navigate one user away it will still show the user that navigated away in the array returned. Maybe I am doing something wrong. Thanks in advance for any help and creating such a great extension!