WebSocketListener Config Error
I complied the WebSocketListener, and configurate it as the readme file says, it runs with some errors!
[Fatal] DarkRiftServer A listener threw an exception while starting, the server cannot be started. System.UriFormatException: Invalid URI: The hostname could not be parsed. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.Uri..ctor(String uriString) at Fleck.WebSocketServer..ctor(String location, Boolean supportDualStack) at WebSocketListener.WebSocketNetworkListener.StartListening() in xxxx、xxxx\DarkRift.Plugins.WebsocketListener\WebSocketNetworkListener.cs:line 31
It can be fixed either by change config or by change code change
<listener name="WebsocketListener" type="WebSocketNetworkListener" address="0.0.0.0" port="4297" >
<settings noDelay="true" />
</listener>
to:
<listener name="WebsocketListener" type="WebSocketNetworkListener" >
<settings address="0.0.0.0" port="4297" noDelay="true" />
</listener>
because the code use address and port in Settings
or you can change WebSocketNetworkListener.cs
private readonly IPEndPoint _ipEndPoint;
public string port;
public string address;
private readonly Dictionary<IWebSocketConnection, WebSocketSessionServerConnection> _connections =
new Dictionary<IWebSocketConnection, WebSocketSessionServerConnection>();
public WebSocketNetworkListener(NetworkListenerLoadData pluginLoadData) : base(pluginLoadData)
{
address = pluginLoadData.Settings["address"];
port = pluginLoadData.Settings["port"];
}
public override void StartListening()
{
_serverSocket = new WebSocketServer("ws://" + address + ":" + port);
to
// private readonly IPEndPoint _ipEndPoint;
// public string port;
// public string address;
private readonly Dictionary<IWebSocketConnection, WebSocketSessionServerConnection> _connections =
new Dictionary<IWebSocketConnection, WebSocketSessionServerConnection>();
public WebSocketNetworkListener(NetworkListenerLoadData pluginLoadData) : base(pluginLoadData)
{
// address = pluginLoadData.Settings["address"];
// port = pluginLoadData.Settings["port"];
}
public override void StartListening()
{
_serverSocket = new WebSocketServer("ws://" + Address + ":" + Port);
because the base class has parse the address an port already。