Commit cbbd24f5 by Stefan Schreistetter

Fixed problem where behavior was not correctly instantiated. Added null checking for sessions.

parent 27325516
...@@ -30,7 +30,7 @@ namespace GazeWebSocketServer ...@@ -30,7 +30,7 @@ namespace GazeWebSocketServer
internal void Publish(GazeData gazeData) internal void Publish(GazeData gazeData)
{ {
Sessions.Broadcast(gazeData.ToString()); Sessions?.Broadcast(gazeData.ToString());
} }
} }
} }
...@@ -9,8 +9,9 @@ namespace GazeWebSocketServer ...@@ -9,8 +9,9 @@ namespace GazeWebSocketServer
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
var wssv = new WebSocketServer("ws://localhost:8001"); var wssv = new WebSocketServer(8001);
wssv.AddWebSocketService("/gaze", () => new GazeCoordinateBehavior()); GazeCoordinateBehavior behavior = new GazeCoordinateBehavior();
wssv.AddWebSocketService("/gaze", () => behavior);
wssv.Start(); wssv.Start();
Console.ReadKey(true); Console.ReadKey(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment