how to get my socket id

Gabriel T

Member
hello

i think all is in the title: how can i get my socket id once a room is joined ? or can i specify the id i want on join ?
and in the same flavor, how can i identify the origin of a message when a message is received through a room ?
thanks !
 

Max

Administrator
Staff member
Hello
how can i get my socket id once a room is joined ? or can i specify the id i want on join ?
Please checkout our Video Chat sample.
It is based on the room API.
https://wcs5-eu.flashphoner.com/client2/examples/demo/streaming/video-chat/video-chat.html
https://wcs5-eu.flashphoner.com/client2/examples/demo/streaming/conference/conference.js
Code:
function joinRoom() {
    connection.join({name: getRoomName()}).on(ROOM_EVENT.STATE, function(room){
        var participants = room.getParticipants();
        console.log("Current number of participants in the room: " + participants.length);
...
}
As you can see you can set arbitrary unique room name and join to the room. Second user can join the same room by room name.
how can i identify the origin of a message when a message is received through a room ?
Here you can see how message is received and how you can get the message origin:
Code:
connection.join({name: getRoomName()}).on(ROOM_EVENT.MESSAGE, function(message){
addMessage(message.from.name(), message.text);
});
Github code:
https://github.com/flashphoner/flas...mples/demo/streaming/conference/conference.js

Developer docs describing room code:
https://flashphoner.com/docs/wcs5/w...ide-2/index.html?video_conference_web_sdk.htm
 
Top