Skip to content

Commit 23ef12d

Browse files
committed
add subprotocol docs to readme
1 parent 20d998e commit 23ef12d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

readme.markdown

+20-1
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,31 @@ server.Start(socket =>
4848
});
4949
```
5050

51+
SubProtocol Negotiation
52+
---
53+
54+
To enable negotiation of subprotocols, specify the supported protocols on
55+
the `WebSocketServer.SupportedSubProtocols` property. The negotiated
56+
subprotocol will be available on the socket's `ConnectionInfo.NegotiatedSubProtocol`.
57+
58+
If no supported subprotocols are found on the client request (the
59+
Sec-WebSocket-Protocol header), the connection will be closed.
60+
61+
```cs
62+
var server = new WebSocketServer("ws://localhost:8181");
63+
server.SupportedSubProtocols = new []{ "superchat", "chat" };
64+
server.Start(socket =>
65+
{
66+
//socket.ConnectionInfo.NegotiatedSubProtocol is populated
67+
});
68+
```
69+
5170
License
5271
---
5372

5473
The MIT License
5574

56-
Copyright (c) 2010-2012 Jason Staten
75+
Copyright (c) 2010-2013 Jason Staten
5776

5877
Permission is hereby granted, free of charge, to any person obtaining a copy
5978
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)