RegarBoy
RegarBoy

Reputation: 3521

Is it possible to talk through websockets without using web browser?

I'm using node websocket ws module on my server and I would like to send commands to my embedded device (Arduino/GPRS module SIM808) from my server. I have used HTTP too, but it takes quite long every time my device establishes connection to send requests.

I should run the client-side written below on arduino to establish connection with webSocket ws sever. But on my embedded device I don't have browser and can only send AT commands to sockets.

var ws = new WebSocket('ws://'+location.host);

ws.onopen = function open() {
    // ws.send('something from client');
};

ws.onmessage = function incoming(data, flags) {
    console.log(data, flags);
    // flags.binary will be set if a binary data is received.
    // flags.masked will be set if the data was masked.
};

function sendMessage(input) {
    ws.send('From Client:' +input);
}

Is there any way I can establish socket communication through my embedded device and web server, how can I talk to web socket server without using web browser?

Upvotes: 0

Views: 2067

Answers (1)

hya
hya

Reputation: 1738

Yes, you can use WebSockets at Arduino.

There are many WebSocket clients:

Upvotes: 2

Related Questions