Skip to content

Commit 2e60856

Browse files
committed
fix: Remove ping check from Server
Websocket keepalive should be good enough for now, and this will fix a lot of issues we have with browser timeouts due to background idling. Fixes #364
1 parent ccd813b commit 2e60856

1 file changed

Lines changed: 48 additions & 43 deletions

File tree

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,48 @@
1-
using System.ComponentModel;
2-
using Buttplug.Components.Controls;
3-
4-
namespace Buttplug.Apps.ServerGUI
5-
{
6-
/// <summary>
7-
/// Interaction logic for MainWindow.xaml
8-
/// </summary>
9-
public partial class MainWindow
10-
{
11-
private readonly ServerControl _wsTab;
12-
13-
public MainWindow()
14-
{
15-
var config = new ButtplugConfig("Buttplug");
16-
uint ping;
17-
uint.TryParse(config.GetValue("buttplug.server.maxPing", "1000"), out ping);
18-
19-
InitializeComponent();
20-
21-
long logLimit = 1000;
22-
if (long.TryParse(config.GetValue("buttplug.log.max", "1000"), out long res))
23-
{
24-
logLimit = res;
25-
}
26-
27-
ButtplugTab.GetLogControl().MaxLogs = logLimit;
28-
29-
ButtplugTab.SetServerDetails("Websocket Server", ping);
30-
_wsTab = new ServerControl(ButtplugTab);
31-
ButtplugTab.SetApplicationTab("Websocket Server", _wsTab);
32-
33-
ButtplugTab.GetAboutControl().CheckUpdate(config, "buttplug-csharp");
34-
Closing += ClosingHandler;
35-
_wsTab.StartServer();
36-
}
37-
38-
private void ClosingHandler(object aObj, CancelEventArgs e)
39-
{
40-
_wsTab?.StopServer();
41-
}
42-
}
43-
}
1+
using System.ComponentModel;
2+
using Buttplug.Components.Controls;
3+
4+
namespace Buttplug.Apps.ServerGUI
5+
{
6+
/// <summary>
7+
/// Interaction logic for MainWindow.xaml
8+
/// </summary>
9+
public partial class MainWindow
10+
{
11+
private readonly ServerControl _wsTab;
12+
13+
public MainWindow()
14+
{
15+
var config = new ButtplugConfig("Buttplug");
16+
uint ping = 0;
17+
18+
// As long as the server is websocket only, we can depend on websocket ping as an
19+
// application keepalive. Once we support both IPC and WebSocket, we should implement
20+
// required ping for IPC.
21+
22+
// uint.TryParse(config.GetValue("buttplug.server.maxPing", "1000"), out ping);
23+
24+
InitializeComponent();
25+
26+
long logLimit = 1000;
27+
if (long.TryParse(config.GetValue("buttplug.log.max", "1000"), out long res))
28+
{
29+
logLimit = res;
30+
}
31+
32+
ButtplugTab.GetLogControl().MaxLogs = logLimit;
33+
34+
ButtplugTab.SetServerDetails("Websocket Server", ping);
35+
_wsTab = new ServerControl(ButtplugTab);
36+
ButtplugTab.SetApplicationTab("Websocket Server", _wsTab);
37+
38+
ButtplugTab.GetAboutControl().CheckUpdate(config, "buttplug-csharp");
39+
Closing += ClosingHandler;
40+
_wsTab.StartServer();
41+
}
42+
43+
private void ClosingHandler(object aObj, CancelEventArgs e)
44+
{
45+
_wsTab?.StopServer();
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)