Browse Source

Using charXchange mumble js v1.1.0 for improved error handling

Closing #1193 @20m
pull/1/head
Martin Bober 3 years ago
parent
commit
3edd565efa
  1. 3
      app/assets/javascripts/gm_screen/mumble_composer.coffee
  2. 23
      public/7f44904e0550dd58af7d.worker.js
  3. 9
      public/charxchange_mumble.js

3
app/assets/javascripts/gm_screen/mumble_composer.coffee

@ -63,7 +63,8 @@
unless speakerDiv
return
speakerDiv.parentElement.removeChild(speakerDiv)
onError: (error) ->
self.issueNotification('danger', createHtmlElement('p', {}, "Mumble Error: #{error.toString()}"))
}
@voiceMeterListener = {

23
public/5a0b29f05dcd52d0f258.worker.js → public/7f44904e0550dd58af7d.worker.js

@ -143,13 +143,18 @@ function reject (reqId, value, transfer) {
function registerEventProxy (id, obj, event, transform) {
obj.on(event, function (_) {
postMessage({
clientId: id.client,
channelId: id.channel,
userId: id.user,
event: event,
value: transform ? transform.apply(null, arguments) : Array.from(arguments)
})
try {
postMessage({
clientId: id.client,
channelId: id.channel,
userId: id.user,
event: event,
value: transform ? transform.apply(null, arguments) : Array.from(arguments)
})
} catch (e) {
let value = transform ? transform.apply(null, arguments) : Array.from(arguments)
console.error(e.toString() + " while posting event '" + event.toString() + "' and value '" + value.toString() + "'")
}
})
}
@ -285,7 +290,7 @@ function setupUser (id, user) {
function setupClient (id, client) {
id = { client: id }
registerEventProxy(id, client, 'error')
registerEventProxy(id, client, 'error', (error) => [error.toString()])
registerEventProxy(id, client, 'newChannel', (it) => [setupChannel(id, it)])
registerEventProxy(id, client, 'newUser', (it) => [setupUser(id, it)])
registerEventProxy(id, client, 'message', (sender, message, users, channels, trees) => {
@ -61530,4 +61535,4 @@ function extend() {
/***/ })
/******/ });
//# sourceMappingURL=5a0b29f05dcd52d0f258.worker.js.map
//# sourceMappingURL=7f44904e0550dd58af7d.worker.js.map

9
public/charxchange_mumble.js

@ -109,7 +109,7 @@ module.exports = {
/***/ (function(module, exports) {
module.exports = function () {
return new Worker("/" + "5a0b29f05dcd52d0f258.worker.js");
return new Worker("/" + "7f44904e0550dd58af7d.worker.js");
};
/***/ }),
@ -209,6 +209,12 @@ function () {
client.on('disconnected', function () {
self._changeStatus("DISCONNECTED");
});
client.on('error', function (error) {
if (self._listeners.onError) self._listeners.onError(error);
if ("Error: write after end" === error && self._voiceHandler != null) self._voiceHandler.setMute(true);
self._changeStatus("ERROR");
});
client.on('message', function (actor, message, targetUsers, targetChannels, targetChannelTrees) {
if (targetUsers.length > 0) {
self._privateMessageReceived(actor, message);
@ -406,7 +412,6 @@ function () {
if (this._listeners['onStatusChanged']) this._listeners['onStatusChanged'](newStatus);
if (newStatus === "CONNECTED" && this._listeners['onConnected']) this._listeners['onConnected']();
if (newStatus === "DISCONNECTED" && this._listeners['onDisconnected']) this._listeners['onDisconnected']();
if (newStatus === "ERROR" && this._listeners['onError']) this._listeners['onError']();
}
}, {
key: "_newUser",

Loading…
Cancel
Save