Giter Site home page Giter Site logo

spark_websockets's People

Contributors

berkley avatar ekbduffy avatar hemstreet avatar kaptk2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spark_websockets's Issues

Spark Library Error

The library hosted at Spark calls for

#include "websocketclient.h"

instead of

#include "Spark-Websockets.cpp"

test.cpp does not work

In build.particle.io, I created a new app from the example test.cpp file. When I click Verify, I am presented with the following errors:

image

Code I am using:

// This #include statement was automatically added by the Particle IDE.
#include "Spark-Websockets/Spark-Websockets.h"


WebSocketClient client;


void onMessage(WebSocketClient client, char* message) {
  Serial.print("Received: ");
  Serial.println(message);
}


/* This function is called once at start up ----------------------------------*/
void setup()
{
    Serial.begin(9600);
    while(!Serial.available()); // Wait here until the user presses ENTER in the Serial Terminal

    client.onMessage(onMessage);
    client.connect("echo.websocket.org");
}

void loop()
{
    client.monitor();
    delay(3000);
    client.send("Hello World!");
}

Implement IPAdress support

Add alternative constructor allowing to specify IP instead of hostname or both (in case of both defined hostname is used only for headers sent - usefull for intranet servers)

Path not used

sendHandshake should also include
WebSocketClientStringTable.replace("{2}", path);,
and WebSocketClientStringTable should have
"GET /{2} HTTP/1.1\x0d\x0a"
as the first line, in order for the path to work.

Error in the GET request

Hi,
it seems there is a problem with the GET request. My websocket server has the following URI:
ws://192.168.10.150/ExampleWebSocket/example.

When I put the code: client.connect("192.168.10.156",8080,"/ws","/ExampleWebSocket/example");
The GET request sniffed with Wireshark has GET / HTTP1.1 and not GET /ExampleWebSocket/example HTTP1.1

Can you fix it?

WebSocketClient::send hangs while writing 4 NOOP bytes

I'm seeing random hangs on the client during websocket communication between the core and node.js after sending 10-200 messages. I've tracked this down to the code that writes the NOOP bytes before printing the payload message to the client. I've done a tcpdump on this and it appears that for some reason the TCP send/ack sequence gets out of order, which causes the client to hang without disconnecting the socket first. Have you seen this issue before? Do you know of a workaround? I can provide you with the tcpdump output if you'd like.

Another tangentially related question: The version of Spark-Websockets published via the Spark web IDE is different from master in your git repository. Should I be using the published version or the master version in git? For what it's worth, I've tried both and had the same result.

Thanks for any help.

'byte' does not name a type

Veryfing code using this library in Particle Build fails with this error:

Spark-Websockets/Spark-Websockets.h:72:3: error: 'byte' does not name a type
   byte _opCode

Trying to compile the example app inside of the web ide and this error happens

readHandshake()

bool result = true;
shouldn't it be initialized to false?

missed quotations

Hey @ekbduffy - thanks for the lib and contribution. Missing a set of parentheses in the example file after the include that doesn't allow the firmware to compile.

Can't compile "How to use" code

I try to compile the example sketch but I get these errors on Spark Build:

In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:29,
from pushbullet_notifications.cpp:2:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
#warning "Defaulting to Release Build"
^
pushbullet_notifications.cpp:3:16: error: variable or field 'onMessage' declared void
void onMessage(WebSocketClient client, char* message);
^
pushbullet_notifications.cpp:3:16: error: 'WebSocketClient' was not declared in this scope
pushbullet_notifications.cpp:3:40: error: expected primary-expression before 'char'
void onMessage(WebSocketClient client, char* message);
^
make: *** [pushbullet_notifications.o] Error 1

Unable to run echo test

When trying the example the websocket does not function. Here is the output of the Photon serial connection:

Connecting...
Connected, sending handshake.
Sending handshake!
GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: echo.websocket.org:80
Origin: SparkWebSocketClient
Sec-WebSocket-Key: 1VTFj/CydlBCZDucDqw8eA==
Sec-WebSocket-Version: 13

Handshake sent
Reading handshake!
handshake rcvd line: HTTP/1.1 101 Web Socket Protocol Handshake
handshake rcvd line: Access-Control-Allow-Credentials: true
handshake rcvd line: Access-Control-Allow-Headers: content-type
handshake rcvd line: Access-Control-Allow-Headers: authorization
handshake rcvd line: Access-Control-Allow-Headers: x-websocket-extensions
handshake rcvd line: Access-Control-Allow-Headers: x-websocket-version
handshake rcvd line: Access-Control-Allow-Headers: x-websocket-protocol
handshake rcvd line: Access-Control-Allow-Origin: SparkWebSocketClient
handshake rcvd line: Connection: Upgrade
handshake rcvd line: Date: Sat, 18 Jul 2015 02:48:22 GMT
handshake rcvd line: Sec-WebSocket-Accept: kuZ2KVbyl4oJOyuTXN/B93O3z9Y=
handshake rcvd line: Server: Kaazing Gateway
handshake rcvd line: Upgrade: websocket
handshake rcvd line:
Handshake Failed! Terminating
Connection Failed!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.