mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-12 23:43:42 +01:00
Implement optional opportunistic pings
This commit is contained in:
parent
3021eae9af
commit
d612c91016
@ -48,6 +48,10 @@ location /socket {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you are unable to configure the proxy timeout accordingly, you can set the
|
||||||
|
`server.ping` option in `config.json` to an interval, in seconds, between which
|
||||||
|
gamja will send opportunistic pings.
|
||||||
|
|
||||||
### Development server
|
### Development server
|
||||||
|
|
||||||
Start your IRC WebSocket server, e.g. on port 8080. Then run:
|
Start your IRC WebSocket server, e.g. on port 8080. Then run:
|
||||||
|
@ -213,6 +213,8 @@ export default class App extends Component {
|
|||||||
* - Default server URL constructed from the current URL location
|
* - Default server URL constructed from the current URL location
|
||||||
*/
|
*/
|
||||||
handleConfig(config) {
|
handleConfig(config) {
|
||||||
|
this.config = config;
|
||||||
|
|
||||||
var host = window.location.host || "localhost:8080";
|
var host = window.location.host || "localhost:8080";
|
||||||
var proto = "wss:";
|
var proto = "wss:";
|
||||||
if (window.location.protocol != "https:") {
|
if (window.location.protocol != "https:") {
|
||||||
@ -531,6 +533,13 @@ export default class App extends Component {
|
|||||||
if (params.autojoin.length > 0) {
|
if (params.autojoin.length > 0) {
|
||||||
this.switchToChannel = params.autojoin[0];
|
this.switchToChannel = params.autojoin[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.config.server && this.config.server.ping > 0) {
|
||||||
|
// TODO: unregister setInterval on disconnect
|
||||||
|
setInterval(() => {
|
||||||
|
client.send({ command: "PING", params: ["gamja"] });
|
||||||
|
}, this.config.server.ping * 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect(netID) {
|
disconnect(netID) {
|
||||||
@ -845,6 +854,7 @@ export default class App extends Component {
|
|||||||
case "CAP":
|
case "CAP":
|
||||||
case "AUTHENTICATE":
|
case "AUTHENTICATE":
|
||||||
case "PING":
|
case "PING":
|
||||||
|
case "PONG":
|
||||||
case "BATCH":
|
case "BATCH":
|
||||||
// Ignore these
|
// Ignore these
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user