Skip to content

Commit 221f271

Browse files
authored
Fix bug for non routed websocket requests (#134)
1 parent 039eb1d commit 221f271

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

nanoFramework.WebServer/WebServer.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,16 @@ private void StartListener()
618618
context.Response.ContentLength64 = 0;
619619
}
620620

621-
context.Response.Close();
622-
context.Close();
621+
// When context has been handed over to WebsocketServer, it will be null at this point
622+
if (context.Response == null)
623+
{
624+
//do nothing this is a websocket that is managed by a websocketserver that is responsible for the context now.
625+
}
626+
else
627+
{
628+
context.Response.Close();
629+
context.Close();
630+
}
623631
}
624632
}).Start();
625633

0 commit comments

Comments
 (0)