Class: ArviaChatEvent

ArviaChatEvent


new ArviaChatEvent()

Events


AUTHENTICATION_ERROR

Dispatched if the authentication fails.
Example
arviaChat.on(ArviaChatEvent.AUTHENTICATION_ERROR, 
 function (e) {
   arviaChat.showNotification('Authentication failed.');
   console.log(e);
 }
);

CONNECT

Dispatched when connected.
Example
arviaChat.on(ArviaChatEvent.CONNECT, 
 function (e) {
   arviaChat.showNotification('Connected to room');
 }
);

CONNECT_ERROR

Dispatched when connect failed.
Example
arviaChat.on(ArviaChatEvent.CONNECT_ERROR, 
 function (e) {
   arviaChat.showNotification('Connect error!');
   console.log(e);
 }
);

CONNECTING

Dispatched when trying to connect.
Example
arviaChat.on(ArviaChatEvent.CONNECTING, 
 function (e) {
   arviaChat.showNotification('Please wait while connecting...');
 }
);

DEVICE_INFO

Dispatched after the getDeviceInfo is called and when the device info is generated.
Example
arviaChat.getDeviceInfo();
// ArviaChatEvent.DEVICE_INFO event is dispatched when device info is generated.
arviaChat.on(ArviaChatEvent.DEVICE_INFO, 
  function (e) {
    console.log(e);
  }
);

DEVICE_INFO_ERROR

Dispatched after the getDeviceInfo is called and when the device info can not be generated.
Example
arviaChat.getDeviceInfo();
// ArviaChatEvent.DEVICE_INFO_ERROR event is dispatched when device info can not be generated.
arviaChat.on(ArviaChatEvent.DEVICE_INFO_ERROR, 
  function (e) {
    console.log('Can not get device info!');
  }
);

DISCONNECT

Dispatched when disconnected.
Example
arviaChat.on(ArviaChatEvent.DISCONNECT, 
 function (e) {
   arviaChat.showNotification('Disconnected from server!');
 }
);

JOIN_REQUEST

Dispatched when the room is locked, someone wants to join the room and you are the room agent.
Example
arviaChat.on(ArviaChatEvent.JOIN_REQUEST, 
 function (e) {
   arviaChat.showNotification('Someone wants to join the room');
   console.log(e);
 }
);

JOIN_ROOM_ERROR

Dispatched when you can not enter the room.
Example
arviaChat.on(ArviaChatEvent.JOIN_ROOM_ERROR, 
 function (e) {
   arviaChat.showNotification('Can not join the room');
   console.log(e);
 }
);

LOCAL_STREAM

Dispatched when the camera access granted.
Example
arviaChat.on(ArviaChatEvent.LOCAL_STREAM, 
 function (e) {
   arviaChat.showNotification('Got video stream from the camera.');
   console.log(e);
 }
);

LOCAL_STREAM_ERROR

Dispatched if the camera can not be accessed.
Example
arviaChat.on(ArviaChatEvent.LOCAL_STREAM_ERROR, 
 function (e) {
   arviaChat.showNotification('Can not access camera.');
   console.log(e);
 }
);

MESSAGE

Dispatched when a message is received.
Example
arviaChat.on(ArviaChatEvent.MESSAGE, 
 function (e) {
   arviaChat.showNotification('Message received.');
   console.log(e.detail.userName);
   console.log(e.detail.userId);
   console.log(e.detail.message);
   console.log(e.detail.date);
 }
);

RECEIVE_SNAPSHOT

Dispatched when a snapshot is received.
Example
arviaChat.on(ArviaChatEvent.RECEIVE_SNAPSHOT, 
 function (e) {
   arviaChat.showNotification('Snapshot received.');
   console.log(e.detail.userName);
   console.log(e.detail.userId);
   console.log(e.detail.url);
   console.log(e.detail.date);
 }
);

ROOM_FULL

Dispatched when the room you are trying to join is full.
Example
arviaChat.on(ArviaChatEvent.ROOM_FULL, 
 function (e) {
   arviaChat.showNotification('This room is full');
   console.log(e);
 }
);

SCREEN_SHARE

Dispatched when the screen access granted.
Example
arviaChat.on(ArviaChatEvent.SCREEN_SHARE, 
 function (e) {
   arviaChat.showNotification('Got screen display to share.');
   console.log(e);
 }
);

SCREEN_SHARE_ERROR

Dispatched if the screen can not be shared.
Example
arviaChat.on(ArviaChatEvent.SCREEN_SHARE_ERROR, 
 function (e) {
   arviaChat.showNotification('Can not get screen display.');
   console.log(e);
 }
);

USER_JOIN

Dispatched when a user joins room.
Example
arviaChat.on(ArviaChatEvent.USER_JOIN, 
 function (e) {
   arviaChat.showNotification('Someone joined the room');
   console.log(e);
 }
);

USER_LIST

Dispatched when the user joins or leaves the room.
Example
arviaChat.on(ArviaChatEvent.USER_LIST, 
 function (e) {
   arviaChat.showNotification('User list updated');
   console.log(e);
 }
);

WAITING_FOR_PERMISSION

Dispatched when the room you are trying to join is locked and waiting for the agent to let you in.
Example
arviaChat.on(ArviaChatEvent.WAITING_FOR_PERMISSION, 
 function (e) {
   arviaChat.showNotification('Waiting for permission from the room agent');
   console.log(e);
 }
);