mirror of
https://github.com/deavmi/nostril
synced 2024-09-20 08:23:40 +02:00
Server
- Use the `bindPort` parameter when configuring the HTTP server - Updated type of `bindPort` to `ushort` - Save the newly created `Connection` instance into its own variable - Do the fiber call later App - Updated type of `bindPort` to `ushort`
This commit is contained in:
parent
920eea8e56
commit
eed104df64
@ -20,7 +20,7 @@ import nostril.server;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
string[] bindAddresseds = ["::"];
|
string[] bindAddresseds = ["::"];
|
||||||
int bindPort = 8082;
|
ushort bindPort = 8082;
|
||||||
Server server = new Server(bindAddresseds, bindPort);
|
Server server = new Server(bindAddresseds, bindPort);
|
||||||
server.startServer();
|
server.startServer();
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,11 @@ public class Server
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
this(string[] bindAddresses, int bindPort)
|
this(string[] bindAddresses, ushort bindPort)
|
||||||
{
|
{
|
||||||
// Setup where to listen
|
// Setup where to listen
|
||||||
this.httpSettings = new HTTPServerSettings();
|
this.httpSettings = new HTTPServerSettings();
|
||||||
httpSettings.port = 8082;
|
httpSettings.port = bindPort;
|
||||||
httpSettings.bindAddresses = bindAddresses;
|
httpSettings.bindAddresses = bindAddresses;
|
||||||
|
|
||||||
// Setup a websocket negotiater with a handler attached
|
// Setup a websocket negotiater with a handler attached
|
||||||
@ -78,7 +78,14 @@ public class Server
|
|||||||
*/
|
*/
|
||||||
void websocketHandler(scope WebSocket socket)
|
void websocketHandler(scope WebSocket socket)
|
||||||
{
|
{
|
||||||
new Connection(socket).call();
|
/* Create a new connection to handle this client */
|
||||||
|
Connection connection = new Connection(socket);
|
||||||
|
|
||||||
|
/* Add it to the queue */
|
||||||
|
// TODO: Add this
|
||||||
|
|
||||||
|
/* Call the fiber and let it start */
|
||||||
|
connection.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user