Comments (24)
This WebSockets2_Generic Library is not currently supporting boards using WiFi101 shield and library.
I already checked and to provide support to this WiFi101 requires drastic changes in both WebSockets2_Generic Library and some changes in WiFi101 library.
Because of the unpopularity of WiFi101 as well as MKR1000, I won't assign this work with high priority. And it'll take weeks to fix / update. Moreover, I don't have this combination MKR1000 + WiFi101 to test.
I suggest you, if urgent. to use another currently-supported combination, such as ESP32, ESP8266, Nano-33-IoT, or even MKR1000 with Ethernet W5x00/EN28J60.
If you're willing to wait, and test within a week or so, I can speed-up the changes for you to test.
Good Luck,
from websockets2_generic.
Hi,
The problem is that they are mkr1000 arduinos already mounted on a special circuit, so I have no choice but to use this combination.
Yes, I could wait a week and test your new version. :)
On the server we have a socket.io, express and nodejs configuration.
I have seen that other products support websockets, but not socket.io.
ArduinoWebSockets (https://github.com/Links2004/arduinoWebSockets) supports socket.io, however it does not support the arduino MKR1000. :(
Socket.io is based on the websockets protocol, but it is a modified and improved protocol, although not compatible with the websockets standard. Socket.io is mostly used with Nodejs.
Do you know if your library is prepared for both the websockets protocol and the improved socket.io?
Thank you very much for all your help.
from websockets2_generic.
You can have a look at my WebSockets_Generic Library, based on ArduinoWebSockets and supporting Socket.IO.
For example Generic_WebSocketClientSocketIO_WiFiNINA example.
If OK and you'll spend time to test, I'll add support to MKR1000 and WiFi101 to that WebSockets_Generic Library
from websockets2_generic.
Yes. Of course. I will be doing the test of all the improvements that you are producing to your library. :)
Do you think you can have a preliminary version in 1 week?
Thank you so much for all your help.
from websockets2_generic.
Will release tomorrow. Almost done
You can test the Modified WiFi101 library now.
from websockets2_generic.
Do you know if the supported version of socket.io in your library corresponds to the supported version of node socket.io (https://www.npmjs.com/package/socket.io)?
from websockets2_generic.
You are wonderful, you are a crack. :)
I'm going to do tests.
I will tell you something.
from websockets2_generic.
No idea yet. Many different implementations out there. But if they stick to the Socket.IO standards, it'll be compatible and OK.
from websockets2_generic.
You have to guide me a bit to do the tests you need to check that everything works correctly.
- I overwrite the installation of my standard WiFi101 library with yours.
- I check that the WiFi101 library examples continue to work.
Do you want me to do something else for now?
from websockets2_generic.
Already publish WebSockets2_Generic Releases v1.3.0
Please test with the Forked WiFi101 library and let me know the result.
Thanks,
Release v1.3.0
- Add support to WiFi101. To be used with Forked WiFi101 library
- Check compatibility with new ESP8266 core v3.0.0
- Suppress warnings
from websockets2_generic.
I overwrite the installation of my standard WiFi101 library with yours.
I check that the WiFi101 library examples continue to work.
Do you want me to do something else for now?
Those are enough tests.
from websockets2_generic.
First analysis.
I have overwritten your WiFi101 library on my computer.
I have tried some examples and they still work. :)
With the library manager of the Arduino IDE I have installed your WebSockects_Generic library.
I have modified the Generic_WebSocketClientSocketIO_WiFiNINA example for SAMD21.
Please tell me if I have done this modification correctly or have to do it differently.
When running the example it cannot connect to my WiFi.
Look at the screenshots.
Tell me if I should do some other tests.
Thanks.
from websockets2_generic.
WebSockects_Generic library is not supporting WiFi101. That's why you have the same hanging issue because it tries to use WiFiNINA, instead of WiFi101.
Have to fix in next step, if necessary.
from websockets2_generic.
Now, just try the WebSockects2_Generic with normal WebSocket server, to see of WiFi101 is working OK.
Use the examples such as SAMD_WiFi101-Minimal-Client.
There are 7 examples
For SAMD21/SAMD51 boards using WiFi101
- SAMD_WiFi101-Client
- SAMD_WiFi101-Minimal-Client
- SAMD_WiFi101-Client_SINRIC
- SAMD_WiFi101-Server
- SAMD_WiFi101-RepeatingClient
- SAMD_WiFi101_ServerAllFunctionsDemo
- SAMD_WiFi101-AdvancedWebServer.
from websockets2_generic.
In WebSockects2_Generic now the WiFi works perfectly, thank you very much.
In the examples you can modify the lines that show the Local IP so that they show it correctly.
Look at the following screenshots:
Thank you very much for your work.
Now I would have to try testing it with a normal websocket server, but I don't have any implementation.
I can try to make a nodejs websocket server.
I'll tell you something.
from websockets2_generic.
Hi Khoi Hoang,
I have made a small standard websocket server based on the nodejs websocket library (https://www.npmjs.com/package/websocket).
The connection to the WiFi is successful, the connection to the server is also correct, but when it try to use the server's websocket the following error occurs:
"Specified protocol was not requested by the client"
Also, as you will see in the screenshots, warnings are produced when compiling the arduino program.
Look at the following screenshots:
Server Source code:
var WebSocketServer = require('websocket').server;
var http = require('http');
var server = http.createServer(function(request, response) {
console.log((new Date()) + ' Received request for ' + request.url);
response.writeHead(404);
response.end();
});
server.listen(8080, function() {
console.log((new Date()) + ' Server is listening on port 8080');
});
wsServer = new WebSocketServer({
httpServer: server,
// You should not use autoAcceptConnections for production
// applications, as it defeats all standard cross-origin protection
// facilities built into the protocol and the browser. You should
// *always* verify the connection's origin and decide whether or not
// to accept it.
autoAcceptConnections: false
});
function originIsAllowed(origin) {
// put logic here to detect whether the specified origin is allowed.
return true;
}
wsServer.on('request', function(request) {
if (!originIsAllowed(request.origin)) {
// Make sure we only accept requests from an allowed origin
request.reject();
console.log((new Date()) + ' Connection from origin ' + request.origin + ' rejected.');
return;
}
var connection = request.accept('echo-protocol', request.origin);
console.log((new Date()) + ' Connection accepted.');
connection.on('message', function(message) {
if (message.type === 'utf8') {
console.log('Received Message: ' + message.utf8Data);
connection.sendUTF(message.utf8Data);
}
else if (message.type === 'binary') {
console.log('Received Binary Message of ' + message.binaryData.length + ' bytes');
connection.sendBytes(message.binaryData);
}
});
connection.on('close', function(reasonCode, description) {
console.log((new Date()) + ' Peer ' + connection.remoteAddress + ' disconnected.');
});
});
Any other tests you want me to do, you tell me.
Thank you.
(Edit) New investigations:
If on the server I accept any protocol by modifying the following line:
var connection = request.accept ('echo-protocol', request.origin);
to
var connection = request.accept (null, request.origin);
the connection is successfully established.
With your library, can you use a specific protocol to communicate with the server?
Look at the following screenshots:
However, I have observed a problem. When using extended characters (Spanish), for example ñ, ó, ... that are in the middle of the sentence to be sent, the connection is blocked, and this is the fault of:
void onMessageCallback(WebsocketsMessage message)
{
Serial.print("Got Message: ");
String sss = message.data();
Serial.println(sss); // <<<< From what I have investigated the problem is in the Serial.println ()
// Do you make any internal variation of the string received from the server?
}
void loop()
{
client.poll();
delay(3000);
c++;
String numero = (String) c;
String WS_msg = c + String(" España: Hello to Server from ") + BOARD_NAME; // **España contains ñ**
// However, if I send the following:
// String WS_msg = c + String(" ñ: Hello to Server from ") + BOARD_NAME;
// everything works correctly, although it also contains the character ñ
// Keep in mind that the same string that is sent to the server, the server sends it back to the client.
client.send(WS_msg);
}
Do you have any idea how to solve this problem?
Thank you so much for all your help.
from websockets2_generic.
Good news that you can find your way out from now on.
You can try this sophisticated SAMD_WiFi101-Client_SINRIC example and control your device from Amazon's Alexa Voice control
and Sinric or SinricPro phone app.
For Spanish character issue, you have to ask on some forums how to solve as I don't have experience with Internationalization
.
Now I would have to try testing it with a normal websocket server, but I don't have any implementation.
You can use the SAMD_WiFi101-Server example, or the similar one written for other boards, to create a test WebSocket Server.
from websockets2_generic.
However, for now I cannot use it with our server, since as I mentioned it works with socket.io.
Now, when you have made the compatibility of WebSockets_Generic I will test if it works with our server with nodejs + socket.io
Very interesting what you tell me about control through Alexa and SinRic. I'll keep it in mind in case we need it. :)
To control an industrial encoder, speed measurement by sections, etc ... do you have any library recommendations?
Also, I have seen that you have very interesting libraries, if I want to prevent the sending of information to the server from interrupting in any way the data that is being received from the encoder, could one of your plugins be used for this?
Thank you very much for all your help.
from websockets2_generic.
Now, when you have made the compatibility of WebSockets_Generic I will test if it works with our server with nodejs + socket.io
I'll put this in my very long bucket lists
- WebSockets_Generic + WiFi101
- WebSockets2_Generic + Socket.IO
In the mean time, you can try to merge the code with Socket.IO-client Library to see if OK.
To control an industrial encoder, speed measurement by sections, etc ... do you have any library recommendations?
Try to use my SAMD_TimerInterrupt, especially
These examples are using ISR and won't be interrupted by other low priority tasks.
from websockets2_generic.
Ahhh .... I thought you told me that by tomorrow you would have a version of WebSockets_Generic + WiFi101, that is what I had understood, for that reason I had been so happy, however, if it is not possible in all ways you I appreciate your efforts.
from websockets2_generic.
Possibly I told you WebSockets2_Generic + WiFi101, not WebSockets_Generic + WiFi101 as this is not in my mind at all. A typo (missing 2 ??)
from websockets2_generic.
I'll try finish WebSockets_Generic + WiFi101 next week as this is much simpler to do than last WebSockets2_Generic + WiFi101
from websockets2_generic.
Ohhh ... that would be wonderful ... thank you so much 👍
from websockets2_generic.
I'm closing this issue now as there is nothing more to do here on this enhancement.
Please open the new issue in WebSockets_Generic to be consistent.
from websockets2_generic.
Related Issues (20)
- Compile error with Arduino Nano RP2040 HOT 2
- VSCode + PIO for Teensy4.1 compilation error. Complaining stm32_eth.h missing! HOT 1
- WebSockets2_generic library and MKR1000 + Ethernet Shield HOT 1
- CA Certificate not getting verified ? HOT 3
- QNEthernet higher latency HOT 10
- QNEthernet and NativeEthernet staticIP not working with WS Server HOT 19
- what is websocketclient if no incoming request? HOT 2
- ESP32-Server Not Working Properly HOT 2
- [Questions] How to receive binary data? HOT 1
- Connect() is blocking? HOT 1
- Error Compiling for board MKR WiFi 1010 HOT 1
- Error 1006 HOT 1
- WebSockets2_Generic example problem HOT 1
- Uploading and running example of ESP "Minimal-Esp32-Client" error [ 4159][E][WiFiClient.cpp:313] setSocketOption(): fail on -1, errno: 9, "Bad file number" HOT 3
- RP2040W-Server example does not compile without errors HOT 1
- Serious problem with timeout when sending packages HOT 1
- Portenta WiFi Websockets tested lately? HOT 5
- Examples Generic WiFiNINA RP2040 ServerAllFunctionsDemo does not work HOT 4
- RP2040 WebSocket immediate disconnection HOT 2
- Multiple Clients Teensy41 server example QNEthernet HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websockets2_generic.