|
|
@@ -108,10 +108,7 @@ export function connect(id: ?string, password: ?string) {
|
|
108
|
108
|
* @returns {void}
|
|
109
|
109
|
*/
|
|
110
|
110
|
function _onConnectionDisconnected(message: string) {
|
|
111
|
|
- connection.removeEventListener(
|
|
112
|
|
- JitsiConnectionEvents.CONNECTION_DISCONNECTED,
|
|
113
|
|
- _onConnectionDisconnected);
|
|
114
|
|
-
|
|
|
111
|
+ unsubscribe();
|
|
115
|
112
|
dispatch(_connectionDisconnected(connection, message));
|
|
116
|
113
|
}
|
|
117
|
114
|
|
|
|
@@ -122,7 +119,9 @@ export function connect(id: ?string, password: ?string) {
|
|
122
|
119
|
* @returns {void}
|
|
123
|
120
|
*/
|
|
124
|
121
|
function _onConnectionEstablished() {
|
|
125
|
|
- unsubscribe();
|
|
|
122
|
+ connection.removeEventListener(
|
|
|
123
|
+ JitsiConnectionEvents.CONNECTION_ESTABLISHED,
|
|
|
124
|
+ _onConnectionEstablished);
|
|
126
|
125
|
dispatch(connectionEstablished(connection));
|
|
127
|
126
|
}
|
|
128
|
127
|
|
|
|
@@ -141,7 +140,6 @@ export function connect(id: ?string, password: ?string) {
|
|
141
|
140
|
function _onConnectionFailed(
|
|
142
|
141
|
err: string, msg: string, credentials: Object) {
|
|
143
|
142
|
unsubscribe();
|
|
144
|
|
- console.error('CONNECTION FAILED:', err, msg);
|
|
145
|
143
|
dispatch(
|
|
146
|
144
|
connectionFailed(
|
|
147
|
145
|
connection, {
|
|
|
@@ -153,15 +151,15 @@ export function connect(id: ?string, password: ?string) {
|
|
153
|
151
|
}
|
|
154
|
152
|
|
|
155
|
153
|
/**
|
|
156
|
|
- * Unsubscribes connection instance from {@code CONNECTION_ESTABLISHED}
|
|
157
|
|
- * and {@code CONNECTION_FAILED} events.
|
|
|
154
|
+ * Unsubscribe the connection instance from
|
|
|
155
|
+ * {@code CONNECTION_DISCONNECTED} and {@code CONNECTION_FAILED} events.
|
|
158
|
156
|
*
|
|
159
|
157
|
* @returns {void}
|
|
160
|
158
|
*/
|
|
161
|
159
|
function unsubscribe() {
|
|
162
|
160
|
connection.removeEventListener(
|
|
163
|
|
- JitsiConnectionEvents.CONNECTION_ESTABLISHED,
|
|
164
|
|
- _onConnectionEstablished);
|
|
|
161
|
+ JitsiConnectionEvents.CONNECTION_DISCONNECTED,
|
|
|
162
|
+ _onConnectionDisconnected);
|
|
165
|
163
|
connection.removeEventListener(
|
|
166
|
164
|
JitsiConnectionEvents.CONNECTION_FAILED,
|
|
167
|
165
|
_onConnectionFailed);
|