Customizing the server behavior of an EasyRTC application is done by creating listeners and associating them with EasyRTC events.
The EasyRTC events
object is directly accessible via the easyrtc
object. As a convienience it is also a child of the pub
, appObj
, connectionObj
, sessionObj
, roomObj
, and connectionRoomObj
.
Setting event listeners in EasyRTC is similar to the node.js events module method. Any differences are noted below.
easyrtc.events.on(eventName, listener);
easyrtc.events.setDefaultListener(eventName);
easyrtc.events.emit(event, [arg1], [arg2], [...], [callback|next]);
Setting a listener overrides the default EasyRTC listener. Depending on your application you may wish to release control back to the default EasyRTC listener.
easyrtc.events.emitDefault(event, [arg1], [arg2], [...], [callback|next]);
Many EasyRTC listeners include a callback as the last parameter. Conventions will differ depending on if it is named 'next' or 'callback'.
next
callback
The best spot (currently) to see all the available events is by reading the default event listeners documentation. This will give you an idea of the events, parameters, and default behavior.
Please feel free to post on our discussion forum:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。