diff --git a/examples/websocket_client/Makefile b/examples/websocket_client/Makefile index 12769bc7..3c70bf60 100644 --- a/examples/websocket_client/Makefile +++ b/examples/websocket_client/Makefile @@ -1,5 +1,6 @@ # -# Copyright (c) 2013 No Face Press, LLC +# Copyright (c) 2014 Jordan Shelley +# https://github.com/jshelley # License http://opensource.org/licenses/mit-license.php MIT License # diff --git a/examples/websocket_client/websocket_client.c b/examples/websocket_client/websocket_client.c index 7eedce0c..294c14dd 100644 --- a/examples/websocket_client/websocket_client.c +++ b/examples/websocket_client/websocket_client.c @@ -1,9 +1,10 @@ /* -* Copyright (c) 2013 No Face Press, LLC +* Copyright (c) 2014 Jordan Shelley +* https://github.com/jshelley * License http://opensource.org/licenses/mit-license.php MIT License */ -// Simple example program on how to use Embedded C interface. +// Simple example program on how to use websocket client embedded C interface. #ifdef _WIN32 #include #else @@ -38,7 +39,7 @@ int main(int argc, char *argv[]) ctx = mg_start(&callbacks, 0, options); char ebuf[100]; - struct mg_connection* newconn = mg_client_websocket_connect("echo.websocket.org", 443, 1, + struct mg_connection* newconn = mg_websocket_client_connect("echo.websocket.org", 443, 1, ebuf, sizeof(ebuf), "/", "http://websocket.org",websocket_data_handler); diff --git a/include/civetweb.h b/include/civetweb.h index 15d34d22..e4e3f39d 100644 --- a/include/civetweb.h +++ b/include/civetweb.h @@ -589,7 +589,7 @@ CIVETWEB_API int mg_strncasecmp(const char *s1, const char *s2, size_t len); typedef int (*websocket_data_func)(struct mg_connection *, int bits, char *data, size_t data_len); -CIVETWEB_API struct mg_connection *mg_client_websocket_connect(const char *host, int port, int use_ssl, +CIVETWEB_API struct mg_connection *mg_websocket_client_connect(const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, websocket_data_func data_func); diff --git a/src/civetweb.c b/src/civetweb.c index 2636e15a..fd6a2d69 100644 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -6596,7 +6596,7 @@ static void* websocket_client_thread(void *data) return NULL; } -struct mg_connection *mg_client_websocket_connect(const char *host, int port, int use_ssl, +struct mg_connection *mg_websocket_client_connect(const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, websocket_data_func data_func) { diff --git a/test/unit_test.c b/test/unit_test.c index 06078308..f988dfce 100644 --- a/test/unit_test.c +++ b/test/unit_test.c @@ -530,7 +530,7 @@ static int websocket_data_handler(struct mg_connection *conn, int flags, char *d return 1; } -static void test_mg_client_websocket_connect(int use_ssl) { +static void test_mg_websocket_client_connect(int use_ssl) { struct mg_connection* conn; char ebuf[100]; int port = HTTP_PORT; @@ -558,19 +558,19 @@ static void test_mg_client_websocket_connect(int use_ssl) { if(use_ssl) { port = 443; } //Not a websocket server path - conn = mg_client_websocket_connect("websocket.org", port, use_ssl, + conn = mg_websocket_client_connect("websocket.org", port, use_ssl, ebuf, sizeof(ebuf), "/", "http://websocket.org",websocket_data_handler); ASSERT(conn == NULL); //Invalid port test - conn = mg_client_websocket_connect("echo.websocket.org", 0, use_ssl, + conn = mg_websocket_client_connect("echo.websocket.org", 0, use_ssl, ebuf, sizeof(ebuf), "/", "http://websocket.org",websocket_data_handler); ASSERT(conn == NULL); //Should succeed, echo.websocket.org echos the data back - conn = mg_client_websocket_connect("echo.websocket.org", port, use_ssl, + conn = mg_websocket_client_connect("echo.websocket.org", port, use_ssl, ebuf, sizeof(ebuf), "/", "http://websocket.org",websocket_data_handler); ASSERT(conn != NULL); @@ -1068,9 +1068,9 @@ int __cdecl main(void) { test_mg_download(1); #endif - test_mg_client_websocket_connect(0); + test_mg_websocket_client_connect(0); #ifndef NO_SSL - test_mg_client_websocket_connect(1); + test_mg_websocket_client_connect(1); #endif test_mg_upload();