Removed common reference from Sock Chat implementation.
This commit is contained in:
parent
f50785a209
commit
9f61c0d4b9
2 changed files with 6 additions and 4 deletions
|
@ -584,7 +584,7 @@ window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } };
|
||||||
'joinfail': 'You are banned.',
|
'joinfail': 'You are banned.',
|
||||||
};
|
};
|
||||||
|
|
||||||
const sockChat = new Umi.Protocol.SockChat.Protocol;
|
const sockChat = new Umi.Protocol.SockChat.Protocol(futami.get('ping') * 1000);
|
||||||
MamiCompat('Umi.Server', { get: () => sockChat, configurable: true });
|
MamiCompat('Umi.Server', { get: () => sockChat, configurable: true });
|
||||||
|
|
||||||
let dumpEvents = false;
|
let dumpEvents = false;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#include common.js
|
|
||||||
#include eventtarget.js
|
#include eventtarget.js
|
||||||
#include servers.js
|
#include servers.js
|
||||||
#include websock.js
|
#include websock.js
|
||||||
|
|
||||||
Umi.Protocol.SockChat.Protocol = function() {
|
Umi.Protocol.SockChat.Protocol = function(pingDuration) {
|
||||||
|
if(typeof pingDuration !== 'number')
|
||||||
|
throw 'pingDuration must be a number';
|
||||||
|
|
||||||
const eventTarget = new MamiEventTarget('mami:proto');
|
const eventTarget = new MamiEventTarget('mami:proto');
|
||||||
|
|
||||||
const parseUserColour = str => {
|
const parseUserColour = str => {
|
||||||
|
@ -93,7 +95,7 @@ Umi.Protocol.SockChat.Protocol = function() {
|
||||||
send('2', selfUserId, text);
|
send('2', selfUserId, text);
|
||||||
};
|
};
|
||||||
|
|
||||||
const startKeepAlive = () => sock?.sendInterval(`0\t${selfUserId}`, futami.get('ping') * 1000);
|
const startKeepAlive = () => sock?.sendInterval(`0\t${selfUserId}`, pingDuration);
|
||||||
const stopKeepAlive = () => sock?.clearIntervals();
|
const stopKeepAlive = () => sock?.clearIntervals();
|
||||||
|
|
||||||
const onOpen = ev => {
|
const onOpen = ev => {
|
||||||
|
|
Loading…
Reference in a new issue