roomrtc
Version:
RoomRTC enables quick development of webRTC
41 lines (33 loc) • 1.21 kB
JavaScript
var test = require('tape');
var RoomRTC = require('../../src/roomrtc');
var socketUrl = 'http://localhost:8123';
var roomName = 'xinchao';
test('Test instance not null', function (t) {
t.plan(3);
var roomrtc = new RoomRTC({
url: socketUrl,
connectMediaServer: true
});
t.ok(roomrtc, 'Initialize roomrtc must be successful');
roomrtc.on("readyToCall", function (id) {
console.log("readyToCall, connectionId: ", id);
t.true(id, 'readyToCall')
return roomrtc.joinMediaServer(roomName)
.then((data) => {
console.log('joinMediaServer ok!', data);
})
.catch((err) => {
console.error('joinMediaServer error: ', err);
t.fail(err);
});
});
roomrtc.on("connected", function (id) {
console.log("connected connectionId: ", id);
t.comment('connected to Server, connectionId: ' + id);
return roomrtc.joinRoom(roomName)
.then((roomData) => {
t.comment('joinRoom success');
t.true(roomData, 'roomData is not null');
})
});
});