We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Does node.js not include packages in opkg yet?



  • @Boken-Lin Well I think the "this" problem was specific to that script because it couldn't authenticate and as such, did not receive a stream. I've tested three different Twitter packages and they all pretty much fail with an authentication error. And, like I also mentioned, if I run the exact same scripts on my Mac, they all run just fine. These scripts don't all use the OAuth libraries either, so it's not and OAuth issues either. I'm thinking either the port of node v0.10.0 on OpenWRT is not complete, or there is a fundamental problem at the OS level on the Onion. However, I think it's more at the Node level, because I can run a curl script against the Twitter streaming API and authenticate just fine.



  • @Steve-Fister Can you send me a copy of your sources? I would like to try it out to figure out what the issue is. I've been able to make HTTP requests using node without much issue on the Omega, and I don't think the twitter login system requires any special HTTP request features.



  • @Boken-Lin You can grab one from here that I am currently using: https://github.com/ttezel/twit

    I've also tried:

    https://github.com/SpiderStrategies/node-tweet-stream
    https://github.com/desmondmorris/node-twitter

    FWIW, I don't think its a HTTP request problem either. I'm hoping you find similar issues (although I would LOVE to get this working!), maybe it will identify an issue somewhere.

    Thanks!



  • @Steve-Fister Ok. I'll try it out and let you know!



  • @Boken-Lin FWIW, I have tested the node.js request module and have verified that I can indeed receive content from a HTTP request.



  • @Steve-Fister Yeah. I'm still trying to pinpoint the issue that's causing the error. So far all HTTP requests have been okay.



  • @Steve-Fister @Boken-Lin I have given this a try, maybe I have a bit more info.

    First I copied over twit. I built it on my mac. I ran into issues with 2 things, har-validator and uuid. These both have bin files. The error I get actually has to do with creating the symlinks when extracting the tar file.

    tar: can't create symlink from ./twitter/node_modules/twit/node_modules/request/node_modules/.bin/har-validator to ../har-validator/bin/har-validator: Operation not permitted
    ./twitter/node_modules/twit/node_modules/request/node_modules/.bin/uuid
    tar: can't create symlink from ./twitter/node_modules/twit/node_modules/request/node_modules/.bin/uuid to ../node-uuid/bin/uuid: Operation not permitted 
    

    I tried to create these myself but wasn't able to. I then ran the simple hello world example, which doesn't use streams like Steve was using, and I don't get a code error, but it comes back telling me it can't authenticate. I tried this same example on my mac it is is successful.

    Twit has one dependency, request, which has many including the two mentioned above. I decided to create another project using just it - no twit. I get the same errors about the bin files, but I was able to connect to and open and display a web page. So the basic request functionality is working, but not when it comes to authenticating. I can see that there would be issues with the bin files if they were used. Not sure what har-validator is needed for.

    I guess we could try to cross-compile request to get the right form of the binaries and try again to link them or just copy them.



  • Oh crap. Just realized I wasn't using 0.10.5 version of node. Tried to use nvm to switch version but not sure it is completely working. It errors doing a search. I don't think I can find twit that works with 0.10.5. I tried package twit-old, it only uses oauth, but I can't get it to work on my mac.



  • @Chris-Ward excellent info! I was trying to narrow it down to a specific module, but hadn't gotten to uuid or har-validate. I did test it in v0.10.0 & v0.10.5 on my Mac and it still continued to work. At least we are on the right track! I'll see if I can't cross compile those two modules for use on this architecture. Thanks!!



  • @Steve-Fister What did you use to get v0.10.5 node on your machine? Windows? OSX? Like I said NVM gave me issues. I couldn't find the twit package, and twit-old wasn't working on my mac.



  • @Chris-Ward I used NPM on my Mac to get the specific version. I actually downgraded my Mac from the latest version to this one without issue.



  • @Steve-Fister yea, ok. I might try that, but I use node for work, and need a different version for that. NVM has worked for me in the past, but I haven't used this old a branch before.



  • @Boken-Lin Ok, so I'm having trouble figuring out how to cross-compile a node package (i.e. twit). I've already cross compiled nodejs using JXCore, but can't seem to find any info on doing this for just a package/module. Any help is appreciated!



  • Hi @Steve-Fister, We are still trying to figure this out ourselves as well. As soon as we figure out a systematic way to do it, we'll post a tutorial on it.

    Currently you just need a package to use the Twitter streaming API? I'm pretty sure there should be a way to use the twitter streaming API without using the request package, which is required by twit and a few other twitter modules for node.js. To solve your immediate problem, I will try to hack together a native-only implementation of the twitter streaming API. Once we have a consistent method to cross-compile node modules, we can then migrate over to existing node modules.

    Does that work?



  • @Boken-Lin Ok, that's kind of what I figured. Thought I could be Superman, guess not 😐

    Yes! If you could figure out a way to get a Twitter stream working in node on the Omega I would OWE YOU BIG TIME!!!!!! 🙂



  • @Steve-Fister There you go: https://github.com/OnionIoT/simple-twitter-stream. I've tested it out and it seems to work. There are probably some bugs, but they should be easy to debug.

    Cheers!



  • @Boken-Lin said:

    https://github.com/OnionIoT/simple-twitter-stream

    You are a Super Hero! Thank you so much for the help on this! I now have my project completely running. I will share the details with the community soon. It's been a very fun little project and I've learned a lot since I unboxed the Omega. My project is not all that special, but it's fun and quirky and uses the Omega!!

    Thank you again!



  • @Steve-Fister Awesome! Looking forward to seeing it 🙂



  • Well, here's my little project! I used a small electro-mechanical toy bird which I purchased online for about $10 (bought a couple in case I made fried parakeet). The bird uses a photoresistor to detect movement in front of the bird, like a hand, and causes the bird to move its head/tail and tweet.

    I remove the photoresistor and connected the pins to one of the Omega's GPIO pins, set to high. With the use of Node.js and a Twitter Streaming module (Thanks @Boken-Lin!!!), I was able to get the bird to chirp by setting the GPIO pin to low, based on the keyword being found in the Twitter Stream!

    I have a short little video of it in action here: https://www.dropbox.com/s/earpuvg5vgdgw24/20151221_145132.mp4?dl=0

    Again, thanks for the help of the Onion Community! Couldn't have done it without you. Looking forward to the next, more in-depth project!



  • @Steve-Fister Wow! That's so cool!!!

    Thanks for sharing 🙂


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.