-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the possibility of dynamically creating p2p rooms in basic example #807
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! some minor comments, just for fun
}; | ||
|
||
createToken('user', 'presenter', roomName, function (response) { | ||
var room_data = {username: 'user', role: 'presenter', room: roomName, type: roomType}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer roomData
extras/basic_example/basicServer.js
Outdated
callback(theRoom); | ||
return; | ||
} | ||
} | ||
N.API.createRoom(roomName, function (roomID) { | ||
|
||
let extra = {data: {basicExampleRoom:true}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basicExampleRoom: true
|
||
var getOrCreateRoom = function (roomName, callback) { | ||
var getOrCreateRoom = function (name, type = 'erizo', callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not callback = function(){}
too?
var username = req.body.username, | ||
role = req.body.role; | ||
if (req.body.room && !isNaN(req.body.room)) room = req.body.room; | ||
if (req.body.type) type = req.body.type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use something like:
let room = req.body.room || defaultRoomName;
let type = req.body.type;
or even:
let {body: {room = defaultRoomName, type}} = req;
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to check that req.body.room is an integer (!isNaN(req.body.room)
). So I'm not sure if just a line is recommended (because probably is possible :D)
Description
Now you can specify the room type when dynamically creating rooms in basic example. Connecting to
https://basic_server:3004/?room=1234&type=p2p
creates a p2p room called '1234'.[] It needs and includes Unit Tests
Changes in Client or Server public APIs
No changes
[] It includes documentation for these changes in
/doc
.