Skip to content
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

Merged
merged 2 commits into from
Mar 17, 2017

Conversation

aalonsog
Copy link
Member

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.

Copy link
Contributor

@jcague jcague left a 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};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer roomData

callback(theRoom);
return;
}
}
N.API.createRoom(roomName, function (roomID) {

let extra = {data: {basicExampleRoom:true}};
Copy link
Contributor

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) {
Copy link
Contributor

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;
Copy link
Contributor

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;

😄

Copy link
Member Author

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)

@aalonsog aalonsog changed the title Added the possibility of dinamically creating p2p rooms in basic example Added the possibility of dynamically creating p2p rooms in basic example Mar 17, 2017
@aalonsog aalonsog merged commit 0eaf57b into lynckia:master Mar 17, 2017
Arri98 pushed a commit to Arri98/licode that referenced this pull request Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants