<div dir="ltr">It seems it only looks at the first defined vhost.  If I move the primary site vhost to the bottom of the config, it no longer loads the site, and I see <span style="font-size:12.8px">LWS_CALLBACK_HTTP.</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 5, 2017 at 9:50 AM, Joel Winarske <span dir="ltr"><<a href="mailto:joel.winarske@gmail.com" target="_blank">joel.winarske@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Here is my config.  I see protocol init happen for each, but I'm not seeing LWS_CALLBACK_HTTP.  If I revert to single vhost, many mounts - init, and LWS_CALLBACK_HTTP happen.  Albeit I can't differentiate what is what.</div><div><br></div><div>{</div><div> "vhosts": [{</div><div>     "name": "localhost",</div><div>     "port": "7681",</div><div>     "mounts": [{<br></div><div>         "mountpoint": "/ui",</div><div>         "origin": "file://c:/etc/lwsws/www",</div><div>         "default": "index.html",</div><div>         "cache-max-age": "60",</div><div>         "cache-reuse": "1",</div><div>         "cache-revalidate": "1",</div><div>         "cache-intermediaries": "0",</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>     "extra-mimetypes": {</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>         ".hbs": "text/x-handlebars-template",</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">              </span> ".json": "text/json"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>     }</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">    </span> }]</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap"> </span> }, {</div><div>     "name": "fileCount",</div><div>     "port": "7681",</div><div>     "mounts": [{</div><div>       "mountpoint": "/ui/fileCount",</div><div>       "origin": "callback://cmd-protocol"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">    </span> }],</div><div>       "ws-protocols": [{</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>     "cmd-protocol": {</div><div>  <span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>   "api" : "3",</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>       "status": "ok"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>     }</div><div>       }]</div><div>     }, {</div><div>     "name": "prop",</div><div>     "port": "7681",</div><div>     "mounts": [{</div><div>       "mountpoint": "/prop",</div><div>       "origin": "callback://cmd-protocol"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">       </span> }],</div><div>       "ws-protocols": [{</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>     "cmd-protocol": {</div><div>  <span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>   "api" : "1",</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>       "status": "ok"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>     }</div><div>       }]</div><div>     }, {</div><div>     "name": "sys",</div><div>     "port": "7681",</div><div>     "mounts": [{</div><div>       "mountpoint": "/sys",</div><div>       "origin": "callback://cmd-protocol"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap"> </span> }],</div><div>       "ws-protocols": [{</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>     "cmd-protocol": {</div><div>  <span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>   "api" : "2",</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>       "status": "ok"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>     }</div><div>       }]</div><div>     }, {</div><div>    "name": "rest",</div><div>     "port": "7681",</div><div>     "mounts": [{</div><div>       "mountpoint": "/rest",</div><div>       "origin": "callback://cmd-protocol"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap"> </span> }],</div><div>       "ws-protocols": [{</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>     "cmd-protocol": {</div><div>  <span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>   "api" : "4",</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>       "status": "ok"</div><div><span class="m_5303502883106512978gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>     }</div><div>       }]</div><div>     }</div><div>  ]</div><div>}</div><div><br></div><div><div>Something else odd I am seeing, I have no valid WS protocols defined, yet the server accepts all client WS requests and indicates it's switched protocols.  Am I missing something here?</div><div><br></div><div><ol class="m_5303502883106512978gmail-children m_5303502883106512978expanded" style="min-width:0px;min-height:0px;box-sizing:border-box;list-style-type:none;padding-left:10px;padding-bottom:5px;font-family:"segoe ui",tahoma,sans-serif;font-size:12px"><li style="min-width:0px;min-height:12px;box-sizing:border-box;text-overflow:ellipsis;white-space:nowrap;display:block;margin-top:1px;margin-left:10px"><div class="m_5303502883106512978gmail-header-name" style="min-width:0px;min-height:0px;box-sizing:border-box;color:rgb(84,84,84);display:inline-block;margin-right:0.5em;font-weight:bold;vertical-align:top;white-space:pre-wrap">Request URL:</div><div class="m_5303502883106512978gmail-header-value m_5303502883106512978gmail-source-code" style="min-width:0px;min-height:0px;box-sizing:border-box;font-family:consolas,"lucida console","courier new",monospace;white-space:pre-wrap;display:inline;margin-right:1em;word-break:break-all;margin-top:1px">ws://localhost:7681/activation</div></li><li style="min-width:0px;min-height:12px;box-sizing:border-box;text-overflow:ellipsis;white-space:nowrap;display:block;margin-top:1px;margin-left:10px"><div class="m_5303502883106512978gmail-header-name" style="min-width:0px;min-height:0px;box-sizing:border-box;color:rgb(84,84,84);display:inline-block;margin-right:0.5em;font-weight:bold;vertical-align:top;white-space:pre-wrap">Request Method:</div><div class="m_5303502883106512978gmail-header-value m_5303502883106512978gmail-source-code" style="min-width:0px;min-height:0px;box-sizing:border-box;font-family:consolas,"lucida console","courier new",monospace;white-space:pre-wrap;display:inline;margin-right:1em;word-break:break-all;margin-top:1px">GET</div></li><li style="min-width:0px;min-height:12px;box-sizing:border-box;text-overflow:ellipsis;white-space:nowrap;display:block;margin-top:1px;margin-left:10px"><div class="m_5303502883106512978gmail-header-name" style="min-width:0px;min-height:0px;box-sizing:border-box;color:rgb(84,84,84);display:inline-block;margin-right:0.5em;font-weight:bold;vertical-align:top;white-space:pre-wrap">Status Code:</div><label class="m_5303502883106512978gmail-resource-status-image" style="min-width:0px;min-height:0px;box-sizing:border-box"><div class="m_5303502883106512978gmail-green-ball" style="min-width:0px;min-height:0px;box-sizing:border-box;width:10px;height:10px;margin-right:4px;display:inline-block;background-image:url("http://Images/smallIcons.png");background-size:190px 30px;background-position:-140px 0px"></div></label><div class="m_5303502883106512978gmail-header-value m_5303502883106512978gmail-source-code" style="min-width:0px;min-height:0px;box-sizing:border-box;font-family:consolas,"lucida console","courier new",monospace;white-space:pre-wrap;display:inline;margin-right:1em;word-break:break-all;margin-top:1px">101 Switching Protocols</div></li></ol></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Feb 1, 2017 at 10:30 PM, Andy Green <span dir="ltr"><<a href="mailto:andy@warmcat.com" target="_blank">andy@warmcat.com</a>></span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
<br>
On 02/02/2017 02:17 PM, Joel Winarske wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Say I want to implement a single plugin for multiple mount points.  In the protocol callback, how do I get the mount point string value?  Do I have to examine the header, or is it already available somewhere?<br>
</blockquote>
<br></span>
The right way to look at it is you created a plugin with a single protocol.<br>
<br>
It happened that multiple mountpoints, usually on a different vhost each time, wanted to mount an instance of that protocol somewhere in their URL space.<br>
<br>
As far as that goes, in itself the protocol callback is not aware of the mountpoint, and the mounts are all treated the same, although you can use per-vhost structs in the callback to mean that mounted protocol instances on each vhost can do things separately.<br>
<br>
To make things more useful, you can pass in "pvo", per-vhost options when you enable the protocol for each vhost individually.  For example the server-status URL I sent before has its protocol enabled like this<br>
<br>
       "lws-server-status": {<br>
         "status": "ok",<br>
         "update-ms": "5000",<br>
         "filepath": "/sys/class/thermal/thermal_zo<wbr>ne0/temp",<br>
         "filepath": "/proc/version",<br>
         "hide-vhosts": "1"<br>
        },<br>
<br>
So you could just as easily enable the protocol on another vhost, but with different settings.<br>
<br>
There are also "pmo", per-mount options the plugin can access.  But pvo are probably want you want if each mount is on a different vhost.<br>
<br>
You can see how the server status plugin gets ahold of the pvo at init<br>
<br>
<a href="https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_lws_server_status.c" rel="noreferrer" target="_blank">https://github.com/warmcat/lib<wbr>websockets/blob/master/plugins<wbr>/protocol_lws_server_status.c</a><br>
<br>
since he stashes them in his per-vhost struct, he can act completely differently simultaneously depndning on the vhost you access him from.<br>
<br>
-Andy<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks!<br>
<br>
<br>
______________________________<wbr>_________________<br>
Libwebsockets mailing list<br>
<a href="mailto:Libwebsockets@ml.libwebsockets.org" target="_blank">Libwebsockets@ml.libwebsockets<wbr>.org</a><br>
<a href="https://libwebsockets.org/mailman/listinfo/libwebsockets" rel="noreferrer" target="_blank">https://libwebsockets.org/mail<wbr>man/listinfo/libwebsockets</a><br>
</blockquote>
<br>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div>