mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
protocol plugins default also add example in test server v2.0
This shows how to deliver per-vhost, per-protocol option name:value pairs using code. Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
f6585285cb
commit
6cca3fbb12
1 changed files with 14 additions and 1 deletions
|
@ -90,6 +90,19 @@ static const struct lws_http_mount mount = {
|
|||
1, /* strlen("/"), ie length of the mountpoint */
|
||||
};
|
||||
|
||||
/*
|
||||
* this sets a per-vhost, per-protocol option name:value pair
|
||||
* the effect is to set this protocol to be the default one for the vhost,
|
||||
* ie, selected if no Protocol: header is sent with the ws upgrade.
|
||||
*/
|
||||
|
||||
static const struct lws_protocol_vhost_options pvo_opt = {
|
||||
NULL,
|
||||
NULL,
|
||||
"default",
|
||||
"1"
|
||||
};
|
||||
|
||||
/*
|
||||
* We must enable the plugin protocols we want into our vhost with a
|
||||
* linked-list. We can also give the plugin per-vhost options here.
|
||||
|
@ -111,7 +124,7 @@ static const struct lws_protocol_vhost_options pvo_1 = {
|
|||
|
||||
static const struct lws_protocol_vhost_options pvo = {
|
||||
&pvo_1,
|
||||
NULL,
|
||||
&pvo_opt,
|
||||
"dumb-increment-protocol",
|
||||
""
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue