From 681b90c17955d7342a48afb1228703203b30aac0 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 8 Mar 2012 14:03:45 +0100 Subject: move javascript code out of html file. --- src/http.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/http.cc') diff --git a/src/http.cc b/src/http.cc index 3dff64e..c755442 100644 --- a/src/http.cc +++ b/src/http.cc @@ -51,6 +51,15 @@ int callback_http(struct libwebsocket_context * context, break; } + // script + if(in && strcmp((const char *)in, "/proto.js") == 0) { + if(libwebsockets_serve_http_file(wsi, + LOCAL_RESOURCE_PATH"/proto.js", + "text/javascript")) + fprintf(stderr, "Failed to send javascript\n"); + break; + } + /* send the script... when it runs it'll start websockets */ if(libwebsockets_serve_http_file(wsi, -- cgit v1.2.3