30 lines
1.3 KiB
C#
30 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
|
|
namespace bts.websocket_core {
|
|
// This does all the bookkeeping for conenctions and data, and passes
|
|
// it over to the business layer
|
|
public class WebsocketDataSync : IWebsocketDataSync {
|
|
// Called when a new client is connected
|
|
public void handle_connection(WebsocketClientID client_id,
|
|
WebsocketIncomingMessage? optional_message) {
|
|
var log_txt = $"WebsocketDataSync.handle_connection client_id: {client_id} " +
|
|
$"message: {(optional_message == null ? "null" : optional_message.ToString())}";
|
|
bts.Log.Gen.info(log_txt);
|
|
System.Console.WriteLine(log_txt);
|
|
}
|
|
// Called when a client is disconnected
|
|
public void handle_disconnection(WebsocketClientID client_id) {
|
|
var log_txt = $"WebsocketDataSync.handle_disconnection client_id: {client_id}";
|
|
bts.Log.Gen.info(log_txt);
|
|
System.Console.WriteLine(log_txt);
|
|
}
|
|
// Called when a client sends data
|
|
public void handle_client_message(WebsocketIncomingMessage message) {
|
|
var log_txt = $"WebsocketDataSync.handle_client_message message: {message}";
|
|
bts.Log.Gen.info(log_txt);
|
|
System.Console.WriteLine(log_txt);
|
|
}
|
|
}
|
|
} |