More socket testing

This commit is contained in:
Rick Falkvinge
2017-01-12 20:46:34 +01:00
parent d3f482a9f1
commit 0f6d01e211
6 changed files with 39 additions and 10 deletions
+2 -2
View File
@@ -75,7 +75,7 @@ namespace Swarmops.Backend
Console.WriteLine ("Creating OutboundComm...");
OutboundComm.CreateNotification (null, NotificationResource.System_Startup);
OutboundComm.CreateNotification (null, NotificationResource.System_Startup_Backend);
Console.WriteLine ("Transmitting...");
@@ -166,7 +166,7 @@ namespace Swarmops.Backend
// Tell sysop we're starting
OutboundComm.CreateNotification (null, NotificationResource.System_Startup);
OutboundComm.CreateNotification (null, NotificationResource.System_Startup_Backend);
// Check for existence of installation ID. If not, create one. Warning: has privacy implications when communicated.
+4
View File
@@ -8,6 +8,8 @@ using Mono.Unix;
using Mono.Unix.Native;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Swarmops.Logic.Communications;
using Swarmops.Logic.Communications.Payload;
using Swarmops.Logic.ExtensionMethods;
using WebSocketSharp.Server;
@@ -31,6 +33,8 @@ namespace Swarmops.Frontend.Socket
Console.WriteLine(" * Swarmops Frontend Socket Server starting up.");
OutboundComm.CreateNotification(null, NotificationResource.System_Startup_Frontend);
_socketServer = new WebSocketServer (12172); // TODO: Read from database
_socketServer.AddWebSocketService<MasterServices> ("/Master");
// _socketServer.KeepClean = false; // as per the author's recommendation - this may be bad in the long run
@@ -144,7 +144,8 @@ namespace Swarmops.Logic.Communications.Payload
public enum NotificationResource
{
Unknown = 0,
System_Startup,
System_Startup_Backend,
System_Startup_Frontend,
System_Exception,
System_DatabaseSchemaUpgraded,
System_DatabaseUpgradeFailed,
@@ -846,18 +846,36 @@ namespace Swarmops.Logic.Resources {
/// <summary>
/// Looks up a localized string similar to Swarmops Backend version [SwarmopsVersion] on host [HostName] has successfully started and connected to database and notification frameworks..
/// </summary>
internal static string System_Startup_Body {
internal static string System_Startup_Backend_Body {
get {
return ResourceManager.GetString("System_Startup_Body", resourceCulture);
return ResourceManager.GetString("System_Startup_Backend_Body", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Swarmops Backend operational.
/// </summary>
internal static string System_Startup_Subject {
internal static string System_Startup_Backend_Subject {
get {
return ResourceManager.GetString("System_Startup_Subject", resourceCulture);
return ResourceManager.GetString("System_Startup_Backend_Subject", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Swarmops Frontend socket server version [SwarmopsVersion] on host [HostName] has successfully started and connected to database and notification frameworks..
/// </summary>
internal static string System_Startup_Frontend_Body {
get {
return ResourceManager.GetString("System_Startup_Frontend_Body", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Swarmops Frontend operational.
/// </summary>
internal static string System_Startup_Frontend_Subject {
get {
return ResourceManager.GetString("System_Startup_Frontend_Subject", resourceCulture);
}
}
@@ -455,12 +455,18 @@ The upgrade will be retried every hour. Some functionality may be disabled until
<data name="System_PublicRootReset_Subject" xml:space="preserve">
<value>Swarmops: Hotwallet public root key reset</value>
</data>
<data name="System_Startup_Body" xml:space="preserve">
<data name="System_Startup_Backend_Body" xml:space="preserve">
<value>Swarmops Backend version [SwarmopsVersion] on host [HostName] has successfully started and connected to database and notification frameworks.</value>
</data>
<data name="System_Startup_Subject" xml:space="preserve">
<data name="System_Startup_Backend_Subject" xml:space="preserve">
<value>Swarmops Backend operational</value>
</data>
<data name="System_Startup_Frontend_Body" xml:space="preserve">
<value>Swarmops Frontend socket server version [SwarmopsVersion] on host [HostName] has successfully started and connected to database and notification frameworks.</value>
</data>
<data name="System_Startup_Frontend_Subject" xml:space="preserve">
<value>Swarmops Frontend operational</value>
</data>
<data name="System_UnrecognizedPayload_Body" xml:space="preserve">
<value>The Swarmops transmission engine on [HostName] has encountered an unknown payload type ([UnrecognizedPayloadType]). This should only happen at very rare occasions in conjunction with upgrades where an upgraded version has to take care of something that changed names in the process, itself a rare phenomenon.
+1 -1
View File
@@ -42,7 +42,7 @@ function _masterInitializeSocket(authenticationTicket) {
}
function getMasterSocketAddress() {
if (location.host.contains ("localhost")) { // Assume dev environment, go for sandbox socket
if (location.host.includes ("localhost")) { // Assume dev environment, go for sandbox socket
return 'ws://sandbox.swarmops.com/ws/Master';
} else {
var protocol = ('https:' == document.location.protocol ? 'wss://' : 'ws://');