krohling / ArduinoWebsocketClient

Websocket client for Arduino
227 stars 72 forks source link

Support Arduino 1.0. #2

Closed borfast closed 12 years ago

borfast commented 12 years ago

Please add support for Arduino 1.0.

This time the pull-request is being done correctly, without me being lazy. :)

krohling commented 12 years ago

Hey Raul, just a heads up. I added Arduino 1.0 support last week. In working on Ethernet support and should be committing the changes in a few days. Thanks for your interest!

On Jan 15, 2012, at 1:22 PM, Raul Pedro Santos reply@reply.github.com wrote:

Please add support for Arduino 1.0.

This time the pull-request is being done correctly, without me being lazy. :)

You can merge this Pull Request by running:

git pull https://github.com/borfast/ArduinoWebsocketClient arduino1.0

Or you can view, comment on it, or merge it online at:

https://github.com/krohling/ArduinoWebsocketClient/pull/2

-- Commit Summary --

  • Support Arduino 1.0.

-- File Changes --

M WebSocketClient.cpp (32) M WebSocketClient.h (14)

-- Patch Links --

https://github.com/krohling/ArduinoWebsocketClient/pull/2.patch https://github.com/krohling/ArduinoWebsocketClient/pull/2.diff


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2

borfast commented 12 years ago

Hi!

Thanks for letting me know. I suppose you're also going to update the Pusher client library?

I'll give it a try when you commit the changes and let you know how ti goes.

And thanks for the great library, it's really useful! :)

krohling commented 12 years ago

Great to hear and yeah updating the Pusher library at the same time.

Thanks, Kevin.

On Jan 16, 2012, at 5:47 AM, Raul Pedro Santos reply@reply.github.com wrote:

Hi!

Thanks for letting me know. I suppose you're also going to update the Pusher client library?

I'll give it a try when you commit the changes and let you know how ti goes.

And thanks for the great library, it's really useful! :)


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2#issuecomment-3510831

krohling commented 12 years ago

Hi Raul, I just pushed an update to the Arduino Websocket Client library adding support for Arduino 1.0 and Ethernet. WiFly support has been temporarily removed. I'll be updating the Pusher client soon, likely tomorrow. In the meantime if you have any feedback on the Websocket client I'd love to hear it. It's in the v1.0 branch:

branch: v1.0 repo: git@github.com:krohling/ArduinoWebsocketClient.git

On Jan 16, 2012, at 5:47 AM, Raul Pedro Santos wrote:

Hi!

Thanks for letting me know. I suppose you're also going to update the Pusher client library?

I'll give it a try when you commit the changes and let you know how ti goes.

And thanks for the great library, it's really useful! :)


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2#issuecomment-3510831

krohling commented 12 years ago

Raul, I just pushed an updated version of the PusherArduinoClient. Updates include: -Added Ethernet support -Upgraded to Arduino 1.0 -Removed WiFly support (temporarily) -Moved strings into Program Memory

FYI, this a pre-release version and has had only limited tested. Please let me know if you have any feedback.

branch: v1.0 repo: git@github.com:krohling/ArduinoPusherClient.git

On Jan 18, 2012, at 12:05 AM, Kevin Rohling wrote:

Hi Raul, I just pushed an update to the Arduino Websocket Client library adding support for Arduino 1.0 and Ethernet. WiFly support has been temporarily removed. I'll be updating the Pusher client soon, likely tomorrow. In the meantime if you have any feedback on the Websocket client I'd love to hear it. It's in the v1.0 branch:

branch: v1.0 repo: git@github.com:krohling/ArduinoWebsocketClient.git

On Jan 16, 2012, at 5:47 AM, Raul Pedro Santos wrote:

Hi!

Thanks for letting me know. I suppose you're also going to update the Pusher client library?

I'll give it a try when you commit the changes and let you know how ti goes.

And thanks for the great library, it's really useful! :)


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2#issuecomment-3510831

borfast commented 12 years ago

Hi krohling ,

Just to let you know that I still haven't had the time to try out the new code but I will play with it sometime during the weekend.

Thanks for letting me know about the updates!

Raúl

krohling commented 12 years ago

You bet, give me a shout if you run into any issues.

On Jan 20, 2012, at 10:47 AM, Raul Pedro Santos wrote:

Hi krohling ,

Just to let you know that I still haven't had the time to try out the new code but I will play with it sometime during the weekend.

Thanks for letting me know about the updates!

Raúl


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2#issuecomment-3588423

borfast commented 12 years ago

Hi krohling,

Looks like it's not going as well as I expected... :)

I'm using the Pusher client library (which makes use of this one) but apparently there's some problem that I can't quite understand.

One thing I noticed is that if I have an infinite loop in the setup() function, the Arduino will freak and repeat the whole setup() function over and over again (I was using the code from one of your examples, to deal with the case where the connection to Pusher.com fails). I confirmed this in a few forums but even after removing the loop from the setup(), I still get the occasional repetition of output. For example:

Local IP is: 172.27.180.197
Oh yeah, we're ippiSPsuêLocal IP is: 172.27.180.197
Oh yeah, we're in baby! :)

Here's the code that generates this output:

// -*- c++ -*-

#include <SPI.h>
#include <Ethernet.h>
#include "PusherClient.h"

// TODO: Isn't there a way to get the damn MAC address from the ethernet shield?!
static uint8_t mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x2F, 0x48 };
//byte ip[] = { 10, 42, 44, 2 }; // IP address assigned via DHCP

PusherClient client;

void setup() {
  Serial.begin(9600);

  // Use a static IP address
  //Ethernet.begin(mac, ip);

  // Use an IP address assigned via DHCP
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
  }

  Serial.print("Local IP is: ");
  Serial.println(Ethernet.localIP());

  if(client.connect("cb713487b5dd6d406775")) {
    Serial.println("Oh yeah, we're in baby! :)");
    client.subscribe("testing123"); 
    client.bind("test_message", handleTestMessage);
  } else {
    Serial.println("No luck...");
  }

  client.triggerEvent("my-event", "{ 'foo': 'bar' }");
}

void loop() {
  //if (client.connected()) {
    client.monitor();
  //}
}

void handleTestMessage(String data) {
   Serial.println("Here's the data I just received from Pusher:");
   Serial.println(data);
}

I don't think the problem is in my code, unless it's some implementation detail that I'm not aware of (such as the infinite loops inside setup() I mentioned above). I also looked in your code but didn't see anything obviously wrong. Maybe it's a buffer overflow somewhere that I missed?

krohling commented 12 years ago

Hey borfast, Thanks for the heads up. I'm looking into this issue and I'll let you know what I find. This may be a memory issue. What Arduino board are you using?

-kevin

borfast commented 12 years ago

Hi Kevin,

I have an Arduino Uno (the first Uno, not the SMD, R2 or R3).

I'll take another shot at the code tomorrow and I'll let you know if I find anything. Oh how I would love to be able to use Valgrind for this... :)

Raúl

borfast commented 12 years ago

Hi Kevin,

I found the culprit: the HashMap implementation!

I'm closing this issue, as Arduino 1.0 is now supported by ArduinoWebsocketClient, and I'm going to open a new pull request for ArduinoPusherClient with the fix for this specific issue.

Raúl

perezd commented 12 years ago

Whats the status on using this library with WiFly modules? I have a GSX/RN-131C module I'd like to use, is that possible? does Arduino's Ethernet library support that natively?

borfast commented 12 years ago

Kevin temporarily removed the WiFly support, so you won't be able to use your module with it and I'm afraid Arduino's Ethernet library doesn't support it either; you have to use another library for it.

perezd commented 12 years ago

What was the reason for removing it, precisely? I may fork it and add it back unless its a horrible idea.

borfast commented 12 years ago

Kevin, the author of this library would have to be the one answering that, but I suppose he removed it because the WiFly library his code relied upon didn't support Arduino 1.0, in which case you'd have to start there and add Arduino 1.0 support to the WiFly library first before putting it back into this one.

Of course I could also be completely wrong... :)

But if you can make it work, I suppose Kevin would be glad to review it and consider adding it to the main project.

perezd commented 12 years ago

Interesting. So, I patched up this WiFly library today to support 1.0: http://arduinology.tumblr.com/WiFlySerial

Its not the one that was being relied on previously, works on 1.0, and does not implement the Ethernet module API, from what I can tell. However, having said all of that, its working. Perhaps I'll fork and try to add support for this particular implementation of the driver.

I'll keep you both posted.

On Feb 8, 2012, at 6:33 PM, Raul Pedro Santos wrote:

Kevin, the author of this library would have to be the one answering that, but I suppose he removed it because the WiFly library his code relied upon didn't support Arduino 1.0, in which case you'd have to start there and add Arduino 1.0 support to the WiFly library first before putting it back into this one.

Of course I could also be completely wrong... :)

But if you can make it work, I suppose Kevin would be glad to review it and consider adding it to the main project.


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2#issuecomment-3880849

borfast commented 12 years ago

Cool!

Even more interesting would be to have an agnostic communications abstraction layer that would use any capable device to transmit it, instead of having to write code for Ethernet, and WiFly, and XBee, etc... but that's a more profound change and one that would need to be done at the official Arduino level.

perezd commented 12 years ago

My understanding was that the Ethernet library was defining the standard, and it was up to devices to conform. For instance, sparkfun wrote a library for wifly that fully implements the ethernet spec, but, doesn't support 1.0. Ugh!

On Feb 8, 2012, at 6:45 PM, Raul Pedro Santos reply@reply.github.com wrote:

Cool!

Even more interesting would be to have an agnostic communications abstraction layer that would use any capable device to transmit it, instead of having to write code for Ethernet, and WiFly, and XBee, etc... but that's a more profound change and one that would need to be done at the official Arduino level.


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2#issuecomment-3880980

krohling commented 12 years ago

Derek, The reason I removed WiFly support was 1) As Raul mentioned the WiFly library doesn't support Arduino 1.0 and also 2) because it requires a different code file given that it doesn't conform to the Ethernet spec.

It sounds like you've found an Arduino 1.0 compatible version of the WiFly library? If so that's great! Is your patched up version available somewhere I could pull it down?

I am planning on tackling WiFly support next week. If you have an Arduino 1.0 compatible version of WiFly that would be a huge help. Also, if you were so inclined to give it a go yourself that'd be great as well.

Raul, Thanks for chiming in on this!

-kevin

On Feb 8, 2012, at 6:36 PM, Derek Perez wrote:

Interesting. So, I patched up this WiFly library today to support 1.0: http://arduinology.tumblr.com/WiFlySerial

Its not the one that was being relied on previously, works on 1.0, and does not implement the Ethernet module API, from what I can tell. However, having said all of that, its working. Perhaps I'll fork and try to add support for this particular implementation of the driver.

I'll keep you both posted.

On Feb 8, 2012, at 6:33 PM, Raul Pedro Santos wrote:

Kevin, the author of this library would have to be the one answering that, but I suppose he removed it because the WiFly library his code relied upon didn't support Arduino 1.0, in which case you'd have to start there and add Arduino 1.0 support to the WiFly library first before putting it back into this one.

Of course I could also be completely wrong... :)

But if you can make it work, I suppose Kevin would be glad to review it and consider adding it to the main project.


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2#issuecomment-3880849


Reply to this email directly or view it on GitHub: https://github.com/krohling/ArduinoWebsocketClient/pull/2#issuecomment-3880875

jinserk commented 11 years ago

Hello,

Thank you for this fantastic library. I also have a request about the WiFly support. Actually it was 8 months ago you mentioned the reason you removed the support, and now, as I know, WiFly follows the Arduino 1.0 spec. Can I know the achievement about the WiFly support?

Thank you so much!

Jinserk