From 79b1519b014732d2362d5f1f14f9401e4bc736eb Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 6 May 2016 15:57:17 +0800 Subject: [PATCH] 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 --- test-server/test-server-v2.0.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test-server/test-server-v2.0.c b/test-server/test-server-v2.0.c index 8702049..debe72b 100644 --- a/test-server/test-server-v2.0.c +++ b/test-server/test-server-v2.0.c @@ -91,6 +91,19 @@ static const struct lws_http_mount mount = { }; /* + * 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", "" }; -- 2.7.4