Skip to content

Commit

Permalink
More tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver_main authored and oliver_main committed Sep 11, 2010
1 parent 1ff2c27 commit dae1fdb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion WebSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ void WebSocket::executeActions(String socketString) {
Serial.print(i);
Serial.print("\n");
#endif
socket_actions[i].socketAction(*this, socketString);
//trim data from before start of message
String substring = socketString.substring(2);
socket_actions[i].socketAction(*this, substring);
}
}

Expand Down
8 changes: 4 additions & 4 deletions examples/Websocket_Actions/Websocket_Actions.pde
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ byte ip[] = { 192, 168, 1, 170 };
WebSocket websocket(PREFIX, PORT);

void helloAction(WebSocket &socket, String &socketString) {
//32 is temp fix while I fix the reciving bit
if(socketString.contains("32Hello")) {

if(socketString.substring(0)=="Hello") {
socket.actionWrite("Hi!");
}
}
void clackAction(WebSocket &socket, String &socketString) {
//32 is temp fix while I fix the reciving bit
if(socketString.contains("32Click!")) {

if(socketString.substring(0)=="Click!") {
socket.actionWrite("Clack!");
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/Websocket_Demo/Websocket_Demo.pde
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ byte ip[] = { 192, 168, 1, 170 };
WebSocket websocket(PREFIX, PORT);

void echoAction(WebSocket &socket, String &socketString) {
socket.actionWrite(&socketString[2]);
socket.actionWrite(&socketString[0]);
}

void setup() {
Expand Down

0 comments on commit dae1fdb

Please sign in to comment.