@@ -33,16 +33,25 @@ namespace ofxLibwebsockets {
3333 string sslKeyPath; // data path to ssl key
3434
3535 string documentRoot; // where your hosted files are (libwebsockets sets up a minimal webserver)
36+
37+ // advanced: timeout options
38+ // names are from libwebsockets (ka == keep alive)
39+ int ka_time; // 0 == default, no timeout; nonzero == time to wait in seconds before testing conn
40+ int ka_probes; // # of times to test for connection; ignored if ka_time == 0
41+ int ka_interval; // how long to wait between probes, in seconds; ignored if ka_time == 0
3642 };
3743
3844 static ServerOptions defaultServerOptions (){
3945 ServerOptions opts;
40- opts.port = 80 ;
41- opts.protocol = " NULL" ;
42- opts.bUseSSL = false ;
43- opts.sslCertPath = ofToDataPath (" ssl/libwebsockets-test-server.pem" , true );
44- opts.sslKeyPath = ofToDataPath (" ssl/libwebsockets-test-server.key.pem" , true );
45- opts.documentRoot = ofToDataPath (" web" , true );
46+ opts.port = 80 ;
47+ opts.protocol = " NULL" ; // NULL == no protocol. most websockets behave this way.
48+ opts.bUseSSL = false ;
49+ opts.sslCertPath = ofToDataPath (" ssl/libwebsockets-test-server.pem" , true );
50+ opts.sslKeyPath = ofToDataPath (" ssl/libwebsockets-test-server.key.pem" , true );
51+ opts.documentRoot = ofToDataPath (" web" , true );
52+ opts.ka_time = 0 ;
53+ opts.ka_probes = 0 ;
54+ opts.ka_interval = 0 ;
4655 return opts;
4756 }
4857
@@ -53,7 +62,11 @@ namespace ofxLibwebsockets {
5362 Server ();
5463 ~Server ();
5564
65+ // setup with default options for websockets
5666 bool setup ( int _port = 80 , bool bUseSSL = false );
67+
68+ // pass in ServerOptions object, which are easily instantiated
69+ // with ofxLibwebsockets::defaultServerOptions()
5770 bool setup ( ServerOptions options );
5871
5972 // close the server
0 commit comments