washo4evr / socket.io-v1.x-library Goto Github PK
View Code? Open in Web Editor NEWSocket.io Library for Arduino
Socket.io Library for Arduino
@washo4evr, have you used this library for a server code written by you? In your comment you write that you are trying to connect to spark fun via HTTP commands. Please clarify if this is a socket.io connection that you are trying to establish or just a TCP connection.
Hi,
Really nice lib !!
Just a quick question, on my socket.io server or client I use:
In my ESP code, I have used: client.sendJSON("messageType","hello");
but my server doesn't receive my "hello"
any tips ?
Thanks !
Hello, after update to the latest version, I can't use the library to connect to a socket.io namespace anymore. Does someone know how to fix it?
How I can edit the buffer size?
I have a problem that I need receive messages with 400 bytes. This library have support for that? Or how I can edit the buffer size?
Hi,
Nice library first I am testing this library sending messages each second for the whole night but at some point I get the module to disconnect from the node.js server.
I want to keep this communication 24/7 alive do you have any idea how can I get a error status or why the chip disconnected ?
I would like to ask for a new feature.
I am using your library to connect to a socket.io server. I would like to use your library also to make HTTP request to the same server that also has an Express instance.
I am using socket.io 1.4.5 and socket is instantiated on an Express instance that could serve HTTP GET/POST/PUT/DELETE and son on..
It would be great to use Socket.io-v1.x-Library to connect to socket.io and to send HTTP request to such server.
I think you are doing something similar in readHandshake method, so i think it could be made a new method (ie: doGet) to parse large body responses.
Can you help?
Thank you very much
Hello
This stack do timeout over lan.
To fix it, need to:
replace in SocketIOClient.cpp:
analogRead(0)
to:
analogRead('A0')
Hello
I'm kind of confuse with the libs. Can I use this libs in other boards such as Arduino Leonado that connected to ESP8266? or I can only use it in ESP8266. When I tried to burn esp8266 example to my Arduino Leonado I always got a "not define interfaces" problem, even though I already defined ESP8266 in the example. I tried both "#define ESP8266" and "#define ESP8266;" when I switched to Arduino Leonado, but I still got the same problem. When I used "GENERIC ESP8266 MODULE" even if I didn't define ESP8266 ,I can verify the codes.
Thank you
Hi, I successfully used the library to connect to my local webserver.
Next step for me is to be able to send data from Arduino to the NodeJS webserver hosted on Heroku, but this piece of code
if (!client.connect(host, port)) { Serial.println("connection failed"); return; }
actually kicks in, therefore the connection seems to not even start. Is it a limit of this library? Any way to overcome it?
Hi there!
I belive there is a missing return in the function SocketIOClient::monitor()
. I tried your ESP8266 example code and it never leaves this condition if (client.monitor())
inside the loop()
function.
If the client isn't connected or available, SocketIOClient::monitor()
returns 0. I belive this function should return 1 if everything is OK and the message was parsed.
Hello, i have problems with implementation this library with Arduino uno + Ethernet Card ENC28J60, this library use a UIPEthernet.h, but this not have a some example to use. I have the library Ethercard.h but i cant change the library in the H file.
Change in the H file this:
#if defined(ENC28J60CARD) //change defined for some conflics of definition with ENC28J60
#include <EtherCard.h> //<UIPEthernet.h>
//#include "SPI.h" //For ENC28J60
#endif
AND
Ethernet client; //EthernetClient client; //For ENC28J60 or W5100
//WiFiClient client; //For ESP8266
and in the sketh include the libraries:
#define ENC28J60CARD
#include <EtherCard.h>
#include "SocketIOClient.h"
But i have some errors:
In file included from /Users/Me/Documents/Arduino/libraries/Socket.io/SocketIOClient.cpp:28:0:
/Users/Me/Documents/Arduino/libraries/Socket.io/SocketIOClient.h:73:5: error: 'Ethernet' does not name a type
Ethernet client; //EthernetClient client; //For ENC28J60 or W5100
^
/Users/Me/Documents/Arduino/libraries/Socket.io/SocketIOClient.cpp: In member function 'bool SocketIOClient::connect(char*, int, char*)':
/Users/Me/Documents/Arduino/libraries/Socket.io/SocketIOClient.cpp:39:9: error: 'client' was not declared in this scope
I hope you can help me.
Thanks.
Hello,
I am having issue with library, i have spent much time trying to figure out what is going on but have had no luck. it seems that parser method may be broken as Rcontent is not being created correctly.
Example.
Server:
function UpdateEsp(){
console.log("Updating Esp!");
console.log(currentEffect);
console.log(JSON.stringify(currentEffect))
socket.emit('FXData', { "FXData" :100 });
};
ESP:
if (client.monitor())
{
if (RID == "FXData")
{
Serial.println(RID);
Serial.println(Rname);
Serial.println(Rcontent);
}
}
Debugger is displaying:
Received message = 42["FXData",{"FXData":100}]
FXData
FXData
00}]
///End
Any ideas what may be causing the issue? I have simplified code to make issue more evident , any help would be greatly appropriated.
Cheers
Hi,
i have been able to compile and run your project. I am using a arduino uno compatible with HanRun ENC28J60 chip.
I am able to enstablish a connection but not to send receive events.
socket.io:client writing packet {"type":2,"data":["welcome",{"message":"Connected !!!!"}],"nsp":"/"} +0ms
socket.io-parser encoding packet {"type":2,"data":["welcome",{"message":"Connected !!!!"}],"nsp":"/"} +0ms
socket.io-parser encoded {"type":2,"data":["welcome",{"message":"Connected !!!!"}],"nsp":"/"} as 2["welcome",{"message":"Connected !!!!"}] +0ms
engine:socket sending packet "message" (2["welcome",{"message":"Connected !!!!"}]) +0ms
socket.io:socket joined room /#idg72gEglm8e9xeJAAAB +1ms
engine:polling closing +1m
engine:polling transport not writable - buffering orderly close +0ms
socket.io:client client close with reason ping timeout +0ms
socket.io:socket closing socket - reason ping timeout +0ms
this is my socket.io log. I really do not have any ideas to solve this.
Hi,
thank you very much for providing your library. Everything I'm doing works just fine expect one problem:
I send a JSON every 500ms. I'm receiving the data on my nodejs server but as soon as I want to emit the data instantly it suddenly stops. (it works 4 to 6 times before it freezes).
Arduino:
void sendJSONdata() {
StaticJsonBuffer<200> jsonBuffer;
String JSON;
JsonObject& root = jsonBuffer.createObject();
root["id"] = sensorId;
root["name"] = sensorName;
JsonObject& data = root.createNestedObject("data");
data.set("timestamp", millis());
data.set("pleth", ESP8266TrueRandom.random(0, 100));
data.set("peakToPeak", ESP8266TrueRandom.random(300, 600));
data.set("bpm", ESP8266TrueRandom.random(80, 120));
data.set("spo2", ESP8266TrueRandom.random(96, 100));
root.printTo(JSON);
Serial.println(JSON);
client.sendJSON("JSON", JSON);
}
JavaScript
socket.on('JSON', function (data) {
var jsonStr = JSON.stringify(data);
//var parsed = ParseJson(jsonStr);
io.emit("test", data);
});
I would be very grateful if you have an idea to this issue. I reached my limits.
I can receive the message:
Received message = 42["p","0,10"]
But if I try to emit anything shorter ex:
["p","0,1"]
The leading 4 is not added, preventing the code from being parsed:
Message size = 52 Before switch Received message = 2["p","0,0"]
Note that the message size reports wrong.
Is this a limitation of Socket.io or something wrong in the library?
Hi, I tried to change IP to the ESP8266 IP (192.168.1.159) and SSID and password but after connect showing error "Exception [28]:" and failed to connect. Another question is how to use index.html and app.js.
Thank you
Any plans to implement Socet.io server (for ESP8266)?
Hi washo4evr,
I think that "return 1;" is missing on line 136 of "SocketIOClient.cpp" file.
Thanks!
I'm getting a 400 error from the "hello-time" example, here's my code, I just changed my IP and the port:
#include "SocketIOClient.h"
#include "Ethernet.h"
#include "SPI.h"
SocketIOClient client;
byte mac[] = { 0xAA, 0x00, 0xBE, 0xEF, 0xFE, 0xEE };
char hostname[] = "10.114.80.107";
int port = 80;
extern String RID;
extern String Rname;
extern String Rcontent;
unsigned long previousMillis = 0;
long interval = 10000;
void setup() {
Serial.begin(9600);
Ethernet.begin(mac);
if (!client.connect(hostname, port))
Serial.println(F("Not connected."));
if (client.connected())
{
client.send("connection", "message", "Connected !!!!");
}
else
{
Serial.println("Connection Error");
while(1);
}
delay(1000);
}
void loop()
{
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval)
{
previousMillis = currentMillis;
//client.heartbeat(0);
client.send("atime", "message", "Time please?");
}
if (client.monitor())
{
Serial.println(RID);
if (RID == "atime" && Rname == "time")
{
Serial.print("Time is ");
Serial.println(Rcontent);
}
}
}
Please help :(
Hallo Washo4evr,
I tried to send multiple JSON data to the Server, but somehow the server can only received one JSON.
is it a normal behaviour?
thanks
in the c++ file i've uncommented every line that Serial prints and says it can be used for debugging. The problem is that nothing seems to print to the console. i only get
wdt reset
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
and sometimes hex blocks.
I'm used to debugging regular arduinos, and I'm to the point i think maybe i should switch esp8266 modules. I'm currently using the nodemcu 1.0, but i own the adafruit version, for example.
So, I guess what I'm asking for is some control experiment advice.
What modules are you using?
Is there some special way to get these particular serial statement out besides the arduino serial window?
wdt reset, and rst cause 4 are from the esp8266 firmware related to watchdog timer. Are you calling for a soft reset somehow?
Hi,
Silly question, but I wonder if this work with socket.io v2.0. Or should I use socket.io v.1 only on the server?
Hello,
as in the title the connection works just fine, but after approximately a minute the connection with socketIO on the nodeJS server is lost, with the client apparently sending the disconnect message to the server.
How could I debug this? The client.monitor() does not show any disconnect message.
Thanks!
I get this error. i have both the github version and the board manager version, and have tried all variations listed of the board:
libraries/Socket.io/SocketIOClient.h:36:17: fatal error: SPI.h: No such file or directory
#include "SPI.h"
Is this legacy of the Billory fork? I'm trying to wrap my head around what it is doing. In the Billory file it fork it gets called in the monitor function. If it is not used I would propose removing it.
Hello @washo4evr !
First of all, sorry if I'm using the wrong place to ask this question, but I didn't found any other way of contact...
I want to know exactly what is the meaning of parameters RID, Rname and Rcontent.
Rcontent I know that is the content of the message itself, it is the "payload", right?
But what should I do with RID and Rname? I'm running the example, but didn't realized what's the real use for these parameters on Server and Client side. I see on server side that are mentions to the Strings 'connection' and 'atime' that, obviously, are triggered on connection event and on Arduino regular asking for time. When asking for a time, Arduino always send "message" as Rname, but I didn't found any use of this parameter on server side.
In my mind, RID is something like a "session identifier"? I couldn't realize a good usage for Rname...
Could you please clarify?
Thanks!
Hey,
I just wanted to connect my ESP8266 to my NodeJS SocketIO Server.
I changed the IP so it matches the right one and I did the same with the port.
Now I am getting this error:
Cannot GET /socket.io/1/?transport=polling&b64=true Trying to reach socket io serverHTTP/1.1 404 Not Found X-Content-Type-Options: nosniff Content-Type: text/html; charset=utf-8 Content-Length: 56 Date: Sun, 13 Nov 2016 01:25:32 GMT Connection: keep-alive
My Server looks like this:
`
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')();
io.on('connection', function (socket) {
console.log("A Device connected!");
socket.on('welcome', function (data) {
console.log(data + " is now connected!");
});
});
http.listen(7331, function(){
console.log('listening on *:7331');
});
`
I am using the newest version from socket.io and this lib.
Hope you can help me to fix,
dunklesToast
Hi @washo4evr
I want to use your library with this project #https://github.com/cheton/cnc and I opened this issue: #cncjs/cncjs#42. In short I want use your library but I can not send/ I don´t know how to send right sequence to server. Could you please look at that issue and help me with this?
Many thanks for reply.
#include "SocketIOClient.h"
//#include "Ethernet.h"
//#include "SPI.h"
#include <ESP8266WiFi.h>
const char* ssid = "test";
const char* password = "testtest";
SocketIOClient client;
//byte mac[] = { 0xAA, 0x00, 0xBE, 0xEF, 0xFE, 0xEE };
char host[] = "192.168.3.101";
int port = 3484;
extern String RID;
extern String Rname;
extern String Rcontent;
unsigned long previousMillis = 0;
long interval = 10000;
void setup() {
pinMode(0, OUTPUT); //for some ethernet shield on the mega : disables the SD and enables the W5100
digitalWrite(0, LOW);
// pinMode(4, OUTPUT);
// digitalWrite(4, HIGH);
Serial.begin(115200);
// Ethernet.begin(mac);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
if (!client.connect(host, port))
Serial.println("Not connected.");
if (client.connected())
{
client.send("connection", "message", "Connected !!!!");
}
else
{
Serial.println("Connection Error");
while(1);
}
delay(1000);
}
void loop()
{
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval)
{
previousMillis = currentMillis;
//client.heartbeat(0);
client.send("atime", "message", "Time please?");
}
if (client.monitor())
{
Serial.println(RID);
if (RID == "atime" && Rname == "time")
{
Serial.print("Time is ");
Serial.println(Rcontent);
}
}
}
Hi There
is there any options to add query ?token=abc when connect socket ? i 'm using Jwt socket auth so i need there is option to do
Thank you
After doing somel examples with the library on my local network, now I am trying to host the server in Heroku so I can access it worldwide. The testing app is already on the cloud and you can access it here: http://funny-led.herokuapp.com
The toggle switch that apprears when opening the page is syncronized over the different opened pages of the app so it seems the socketio server is running fine.
The problem I am facing is that I can not get the ESP8266 connected to socketio server. I have tried with:
char host[] = "funny-led.herokuapp.com";
int port = 1234;
with both connect and connectHTTP with no success
I have also tried with including http:// on the URL but more of the same
Also tried with the public IP of Heroku....same thing
Testing accessibility to the server I have done a GET of the styles.css file and I got the content so that was fine.
Any comment on what I am doing wrong would be much appreciated!!
Git repo is https://github.com/hipotenusa/funny-led
Thanks in advance
Hi,
I am unable to connect to SocketIO server. Following is my sketch file:
#include <ESP8266WiFi.h>
SocketIOClient client;
const char* ssid = "myssid";
const char* password = "mypwd";
char host[] = "192.168.0.132";
int port = 3000;
extern String RID;
extern String Rname;
extern String Rcontent;
void setup() {
Serial.begin(115200);
delay(10);
setupWifi();
if (!client.connect(host, port)) {
Serial.println("connection failed");
return;
}
if (client.connected())
{
client.send("connection", "message", "Connected !!!!");
}
}
void setupWifi(){
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
// put your main code here, to run repeatedly:
}`
Following is the output on serial
WiFi connected
IP address:
192.168.24.106
[hostByName] Host: 192.168.0.132 is a IP!
connection failed
Hi, I am using the ESP8266 with socket.io 1.7 on the server, but when the esp8266 receives the 9th message it gets disconnected. Did someone has notice this?
I am using the example server and the example .ino file
Firstly, my congratulations for the library! It's best way to get rid of MQTT and use socket.io everywhere.
I used your example in localhost with port 3484 and works fine.
But my cloud server don't accept other port to listen.
I changed both in your app.js and Hello_Time_ESP8266.ino the number of port to 80 and the ESP connect and disconnect sequentially.
[readHandshake] Connected. SID=o6lx5IknVIMyIdcLAAAw
[readHandshake] Websocket failed.[monitor] Can't connect. Aborting.
[monitor] Client not connected.
Do you have suggestions to solve this problem?
Hi @washo4evr
I want to use your library but I can not get rid of this error:
#error "above your includes like so : #define ESP8266 "
. I did find older library where I donť have to define this but I want use most up to date library.
Also, could by posible use client.send("list")
? I can now use your library like this: client.send("list", "list", "list")
Here is my Arduino code:
Many thanks for reply.
Hi,
I am using socket.io and with Node.js on server. The client ESP8266 connects successfully but the problem that i am facing is 'ping time out'. When the connection is idle for around 1-2 minutes the the ESP8266 client ping time outs on the server and gets disconnected.
I send Json message from client to server and it look like this:
42["device_state",{"device_id":"1","data":" "TEMPERATURE": "0", "HUMIDITY": "8", "pH": "2", "EC": "6", "LUX": "6" "}]
but what i got in server is not the same and it look like this:
42["device_state",{"device_id":"1","data":" "TEMPERATURE": "02520252025202520252025202520252025202520252025202520252025202
I think problems is 2 variables mask and masked in function emit. I checked the log and saw the mask always are 2740 and 2520. So how can I emit message without using mask and masked :D
Thanks in advance !!!
it works fine however turn off socketio server for 1 second and start it
ESP8266 could not auto reconnect again socket send and receive now lost.
i hope this features could be added son.
I'm not sure if my issue is the same as #22 , so I'm creating a new one.
This is my log when I try to connect to NodeJS server from ESP8266:
HTTP/1.1 200 OK
97:0{"sid":"TvbbAMyWh9dUUakzAAAB","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}
Connected. SID=TvbbAMyWh9dUUakzAAAB
Connecting via Websocket`
This just sits there and doesn't recieve a 101
response.
Here is my server side log when connecting from ESP :
engine intercepting request for path "/socket.io/" +2m
engine handling "GET" http request "/socket.io/1/?transport=polling&b64=true" +0ms
engine handshaking client "ewG8sx4FXkVoZ3bgAAAC" +2ms
engine:socket sending packet "open" ({"sid":"ewG8sx4FXkVoZ3bgAAAC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}) +0ms
engine:polling setting request +0ms
engine:socket flushing buffer to transport +0ms
engine:polling writing "97:0{"sid":"ewG8sx4FXkVoZ3bgAAAC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}" +0ms
engine:socket executing batch send callback +1ms
socket.io:server incoming connection with id ewG8sx4FXkVoZ3bgAAAC +0ms
socket.io:client connecting to namespace / +0ms
socket.io:namespace adding socket to nsp / +0ms
socket.io:socket socket connected - writing packet +0ms
socket.io:socket joining room /#ewG8sx4FXkVoZ3bgAAAC +1ms
socket.io:client writing packet {"type":0,"nsp":"/"} +0ms
socket.io-parser encoding packet {"type":0,"nsp":"/"} +0ms
socket.io-parser encoded {"type":0,"nsp":"/"} as 0 +0ms
engine:socket sending packet "message" (0) +0ms
[12/08/2016 13:23:19.960] [LOG] connected
[12/08/2016 13:23:19.960] [LOG] /#ewG8sx4FXkVoZ3bgAAAC
socket.io:socket joined room /#ewG8sx4FXkVoZ3bgAAAC +0ms
engine:polling closing +1m
engine:polling transport not writable - buffering orderly close +0ms
socket.io:client client close with reason ping timeout +1ms
socket.io:socket closing socket - reason ping timeout +0ms
[12/08/2016 13:24:44.959] [LOG] DISCONNECTING!!!
But I am able to connect without issues from a browser client :
engine intercepting request for path "/socket.io/" +17s
engine handling "GET" http request "/socket.io/?EIO=3&transport=polling&t=1471007843270-0" +0ms
engine handshaking client "OMCzE_KVRlXRCZiFAAAA" +2ms
engine:socket sending packet "open" ({"sid":"OMCzE_KVRlXRCZiFAAAA","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}) +1ms
engine:polling setting request +0ms
engine:socket flushing buffer to transport +1ms
engine:polling writing " �0{"sid":"OMCzE_KVRlXRCZiFAAAA","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}" +1ms
engine:socket executing batch send callback +2ms
socket.io:server incoming connection with id OMCzE_KVRlXRCZiFAAAA +0ms
socket.io:client connecting to namespace / +0ms
socket.io:namespace adding socket to nsp / +0ms
socket.io:socket socket connected - writing packet +1ms
socket.io:socket joining room /#OMCzE_KVRlXRCZiFAAAA +0ms
socket.io:client writing packet {"type":0,"nsp":"/"} +1ms
socket.io-parser encoding packet {"type":0,"nsp":"/"} +0ms
socket.io-parser encoded {"type":0,"nsp":"/"} as 0 +0ms
engine:socket sending packet "message" (0) +0ms
[12/08/2016 13:17:27.876] [LOG] connected
[12/08/2016 13:17:27.876] [LOG] /#OMCzE_KVRlXRCZiFAAAA
socket.io:socket joined room /#OMCzE_KVRlXRCZiFAAAA +1ms
engine intercepting request for path "/socket.io/" +332ms
engine handling "GET" http request "/socket.io/?EIO=3&transport=polling&t=1471007843931-1&sid=OMCzE_KVRlXRCZiFAAAA" +0ms
engine setting new request for existing client +0ms
engine:polling setting request +0ms
engine:socket flushing buffer to transport +0ms
engine:polling writing "�40" +0ms
engine:socket executing batch send callback +1ms
engine upgrading existing transport +327ms
engine:socket might upgrade socket transport from "polling" to "websocket" +0ms
engine:ws received "2probe" +319ms
engine:ws writing "3probe" +0ms
engine:ws received "5" +843ms
engine:socket got upgrade packet - upgrading +0ms
engine:polling closing +1ms
engine:polling transport discarded - closing right away +0ms
engine:ws received "2" +23s
engine:socket packet +0ms
engine:socket got ping +0ms
engine:socket sending packet "pong" (undefined) +0ms
engine:socket flushing buffer to transport +0ms
engine:ws writing "3" +0ms
Any ideas as to what might be the issue??
Hi there,
First of all - I thanks for spending time and creating this library.
I simply took a look at it, but since I have already background experience with socket.io from other projects, I was expecting to see at least two key methods:
emit
- the one which is used to send the message to the server. I guess in your case send
is the substitute, correct?on
- this is callback method allows client to receive messages from the server. This one I totally missed.I would appreciate if you can elaborate on the above and let me know how your lib actually implements those two key socket.io methods.
Thanks,
Angel
I am refactoring the code to meet my application and as I am doing so I came across the message length. I have just started looking at what Wireshark sniffing, but I thought I would also go to the source. I'm confused on the message length in mask. Your comments say 128 due to the mask, for say the "52" to upgrade, but the mask is only 4 bytes long? I'm missing something really stupid and I know it.
I think there is a problem in the monitor function. I never returns true.
I tried to add 'return 1' in the function, and now it works.
I also never got the callback to work. I cannot se it is handled in the code??
Hi,
I trying to use your library send and receive data 10ms/times and get some problem: esp8266 lagging like video https://youtu.be/DKr2FgKOwdg. I dont know how to fix it. I need some help, many thanks
Hi.
I'm using ESP8266 07 and downloaded the Hello_Time_ESP8266.ino example and your app.js and index.html.
I did not do any change in your codes, just set IP to 127.0.0.1, but socket does not connect!
Here is the screenshot of my browser when app.js is running:screenshot
Also here is my codes attached:codes
I would appreciate any help
Hi washo4evr,
I have been using your library with enc28j60, socket.io 1.3.7, and have the following issues/questions.
After this any data sent from the client to the server is not received although handshake has happened. After a little while (random number of attempts and unknown time ) it is attempting a reconnection and gets connected properly after which communication happens normally. This behavior is not consistent (random).
Question: Any idea what is happening here? Am I missing something here?
engine:ws writing "42["welcome",{"message":"Connected !!!!"}]" +0ms
engine:ws received "������65!Y����17'^��26%x]��55"xZ�" +952ms
Question: Any thoughts here?
engine:polling transport not writable - buffering orderly close +0ms
Transport Error file with code.txt
Question: What is the potential cause of these transport errors?
Thank you
Hari
Hi there
thanks for the Library! and I got it working on localhost.
However when i try to connect to it on openshift it give me a HTTP/1.1 400 Bad Request when upgrading the socket it think.
The sever gets the initial connection fine but then the arduino give the error.
I have put a Serial.print to show that it if does not get pass if (atoi(&databuffer[9]) != 101) {
any help would be fantastic, as this Library is amazing !!
Best
Ben
I have a SparkFunESP8266 and I try to user Socket.io to send and receive instant messages.
I-am using #include <SparkFunESP8266WiFi.h> to connect to my wifi network... works fine ...
I use in my setup section the code:
client.setDataArrivedDelegate(ondata);
if (!client.connect(server, port)){
Serial.println(F("Not connected."));
}
and I receive "Not connected" ...
I open the SocketIOClient.cpp and on the ::connect i see that function ::sendHandshake(hostname); witch works fine and I receive the following answer:
+IPD,0,357:HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 100
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: Arduino
Set-Cookie: io=1bO6tm54TbT7t-QtAAAC
Date: Mon, 07 Mar 2016 04:01:45 GMT
Connection: keep-alive
and the socket.io server detects that there is a new connection ...
The problem comes in the next line of the ::connect on ::readHandshake();
... this section of code:
if (atoi(&databuffer[9]) != 200) {
while (client.available()) readLine();
client.stop();
return false;
}
always return false and the program stop working.
I use on my server node -v : 4.2.2 and [email protected]
I do not know c++ to work with SocketIOClient.cpp
Can you help me ?
Will this library work with an ESP32? I am currently using this websockets library for communication with my server: https://github.com/warmcat/lws-esp32-factory but I would like to use socket io since that's what I use in all other parts of my system.
i'm making a python/flask example because i thought you might like to add it to your examples, and because python/flask is my goto stuff, but messages, strings or json, won't seem to work. while the esp starts to boot the server registers the connection but the serial port output says the connection failed, then, on each attempt from the esp8226 to send some data, i get bad syntax, bad format errors serverside.
67.182.247.83 - - [07/Mar/2016 22:24:32] code 400, message Bad request version ('\x07\x00\x00\x00\x06\x01\x00')
67.182.247.83 - - [07/Mar/2016 22:24:32] "??8451
nJQVTQB__kFTVGZCgAEUY@POB]ZF^J_DFAXUQ
" 400 -
(15773) accepted ('67.182.247.83', 37155)
67.182.247.83 - - [07/Mar/2016 22:24:42] code 400, message Bad request syntax ('\x81\xdc1685\x05\x04c\x17CS[PX@Q[ViKP_EWGnCHQPB]\x17\x1dM\x1aFTXKZC\x14\x02\x17VFK\x17\x1d\x14L\S\x1a\x0f\x00\x05\r\x04\t\x04\x0c\x04\x03\x06\x14\x17UWLT\x13\x0cc\x01\t\x18\x0f\x00\x07\x06\x00\x04\x1d\x04\x16\x06\x01\x04\x08\x06\tkEh\x81\xdc3855\x07')
67.182.247.83 - - [07/Mar/2016 22:24:42] "??1685cCS[PX@Q[ViKP_EWGnCHQPB]MFTXKZCVFKL\S
you can see the example i'm building here: https://github.com/luxnovalabs/water_sensor
and you are welcome to try to connect your exp8266 at 107.170.232.185:5000
107.170.232.185:5000/home will give you a simple webpage that i've been using to ping the server and monitor the messages.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.