[Libwebsockets] need help - lwsws && external plugin

Joel Winarske joel.winarske at gmail.com
Thu Jan 19 02:44:09 CET 2017


Hi folks,


I'm unclear on how to setup an external plugin.  I have my lwsws config
setup as:


      "mounts": [{
        "mountpoint": "/",
        "origin": "file:///var/www/paper.local",
        "default": "index.html"
        }, {
         "mountpoint": "/prop",
         "origin": "callback://property-api"
      }]


The server startup:
lwsws[16680]:   Plugins:
lwsws[16680]:   Scanning /usr/local/share/libwebsockets-test-server/plugins/
lwsws[16680]:    libprotocol_example_standalone.so
lwsws[16680]:  Compiled with OpenSSL support
lwsws[16680]:  mem: per-conn:          768 bytes + protocol rx buf
lwsws[16680]:  canonical_hostname = paper
lwsws[16680]:  Using foreign event loop...
lwsws[16680]: ----file:///var/www/paper.local
lwsws[16680]: ----callback://property-api
lwsws[16680]: Creating Vhost 'paper.local' port 41795, 1 protocols, IPv6 off
lwsws[16680]:    mounting file:///var/www/paper.local to /
lwsws[16680]:    mounting callback://property-api to /prop


When I send client request:
curl -k "
http://paper.local:41795/prop/get?format=json&key=xyz&dataID=Y0NoMPgXlXDR3tXIL7dODR
"

I get:
lwsws[16680]: Unable to find plugin 'property-api'
lwsws[16680]: 172.16.19.75 - - [18/Jan/2017:17:23:30 -0800] "GET /prop/get
http/1.1" 0 0 Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,
like Gecko) Ubuntu Chromium/55.0.2883.87 Chrome/55.0.2883.87 Safari/537.36

In my plugin the protocols struct is set as:
static const struct lws_protocols protocols[] = {
{
"property-api",
callback_property,
sizeof(struct per_session_data__dumb_increment),
10, /* rx buf size must be >= permessage-deflate rx size */
},
};

My goal is to handle this portion of the request "
get?format=json&key=xyz&dataID=Y0NoMPgXlXDR3tXIL7dODR".

What am I missing?



Thanks!
Joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20170118/cdc1421d/attachment-0001.html>


More information about the Libwebsockets mailing list