Skip to content

Commit 8deec09

Browse files
Merge pull request #83 from natxopedreira/master
method to change waitingMillis
2 parents 656666d + 1b5724d commit 8deec09

File tree

6 files changed

+12
-1
lines changed

6 files changed

+12
-1
lines changed

example_client_hello_world/src/ofApp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ void ofApp::setup(){
55
ofBackground(0);
66
ofSetLogLevel(OF_LOG_VERBOSE);
77
// basic connection:
8+
client.setWaitMillis(100);
89
client.connect("echo.websocket.org");
910
// OR optionally use SSL
1011
// client.connect("echo.websocket.org", true);

libs/ofxLibwebsockets/include/ofxLibwebsockets/Client.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,6 @@ namespace ofxLibwebsockets {
104104

105105
bool bShouldReconnect;
106106
uint64_t lastReconnectTime;
107+
107108
};
108109
};

libs/ofxLibwebsockets/include/ofxLibwebsockets/Connection.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ namespace ofxLibwebsockets {
3636
Connection(Reactor* const _reactor=NULL, Protocol* const _protocol=NULL);
3737

3838
~Connection();
39+
40+
3941
void close();
4042
void send(const std::string& message);
4143

libs/ofxLibwebsockets/include/ofxLibwebsockets/Reactor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ namespace ofxLibwebsockets {
4747

4848
unsigned int _http(struct libwebsocket *ws, const char* const url);
4949

50+
void setWaitMillis(int millis);
51+
5052
protected:
5153
std::string document_root;
5254
unsigned int waitMillis;

libs/ofxLibwebsockets/src/Client.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ namespace ofxLibwebsockets {
3535
Client::Client(){
3636
context = NULL;
3737
connection = NULL;
38-
waitMillis = 0;
38+
waitMillis = 1;
39+
3940
//count_pollfds = 0;
4041
reactors.push_back(this);
4142

libs/ofxLibwebsockets/src/Reactor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ namespace ofxLibwebsockets {
4141
return (idx < protocols.size())? protocols[idx].second : NULL;
4242
}
4343

44+
//--------------------------------------------------------------
45+
void Reactor::setWaitMillis(int millis){
46+
waitMillis = millis;
47+
}
4448
//--------------------------------------------------------------
4549
void Reactor::close(Connection* const conn){
4650
if (conn != NULL && conn->ws != NULL){

0 commit comments

Comments
 (0)