websocket client ethernet hello world example

Dependencies:   WebSocketClient EthernetInterface mbed-rtos mbed

Websocket client hello world over ethernet

main.cpp

Committer:
samux
Date:
2012-08-23
Revision:
2:00da1457c871
Parent:
1:1c1802ec42a2

File content as of revision 2:00da1457c871:

#include "mbed.h"
#include "EthernetInterface.h"
#include "Websocket.h"
 
 
int main() {
    char recv[30];
 
    EthernetInterface eth;
    eth.init(); //Use DHCP
    eth.connect();
    printf("IP Address is %s\n\r", eth.getIPAddress());
 
    Websocket ws("ws://sockets.mbed.org:443/ws/demo/wo");
    ws.connect();
 
    while (1) {
        ws.send("WebSocket Hello World over Ethernet");
        wait(1.0);
    }
}