Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 03 04:37
    stale[bot] closed #231
  • Sep 03 04:37
    stale[bot] commented #231
  • Aug 27 04:21
    stale[bot] labeled #231
  • Aug 27 04:21
    stale[bot] commented #231
  • Aug 13 03:22
    JsonMa commented #231
  • Aug 12 18:02
    BobFrankston commented #231
  • Aug 12 02:56
    JsonMa commented #231
  • Aug 12 02:48
    JsonMa commented #231
  • Aug 07 20:40
    BobFrankston commented #231
  • Aug 07 20:30
    BobFrankston commented #231
  • Aug 06 06:52
    Apollon77 commented #231
  • Aug 06 06:51
    Apollon77 commented #231
  • Aug 06 06:51
    Apollon77 commented #231
  • Aug 06 06:49
    Apollon77 commented #231
  • Aug 05 23:38
    BobFrankston opened #231
  • Jul 28 05:08
    Apollon77 labeled #195
  • Jul 28 05:07
    Apollon77 commented #195
  • Jul 28 01:48
    stale[bot] unlabeled #195
  • Jul 28 01:48
    sjlongland commented #195
  • Jul 28 00:11
    stale[bot] labeled #195
Matteo Collina
@mcollina
it's not possible to use node-coap inside the browser: you cannot send UDP packets.
You should be able to use it inside electron/nw.js
Oliver Ford
@OJFord
Oops - sorry for ninja edit, didn't see your response, fast - thanks :)
Oliver Ford
@OJFord

Is the server.on('close') event supported? I call close, but my event callback is never executed before I get the exception:

.../coap/lib/server.js:189
this._sock.close()
TypeError: Cannot read property 'close' of null

Matteo Collina
@mcollina
listen() must happen before close
it's not guarded
would you mind sending a PR fixing that?
Oliver Ford
@OJFord

I certainly can, but I'm fairly certain this occurred after listen(), I shall check in the morning. My intention was to close, and then begin listening again on a different port (hence waiting for the 'close' event).

I'll have another look and let you know.

Oliver Ford
@OJFord

Never mind, in a very minimal test to verify PR #74 it seems to work exactly as I'd intended (with the callback which I had also tried, rather than 'close' event), so the issue may be elsewhere in the application.

Hopefully skipping past the "undefined.close()" error will shed some further light.

Matteo Collina
@mcollina
@OJFord awesome :). I'll merge later today
Oliver Ford
@OJFord
I don't have any experience with Mocha, but I'll have a crack at it later.
Oliver Ford
@OJFord
Oh, actually, it didn't even pass existing tests :/ Not sure why though. How can it determine there aren't "4 retries within 45s" in 9s..?
Oliver Ford
@OJFord
@mcollina I made the shuffle you requested in diff comments.
Unrelated -- am I correct in thinking that if I make a coap.request(), then on response the res.outSocket.port is the source port of my request?
Matteo Collina
@mcollina
yes
Oliver Ford
@OJFord
Thanks, I thought so, but is it possible to set this (before making the request ofc)? Or better yet, to make it from a running server?
Matteo Collina
@mcollina
You can create a server and use that as a proxy
Oliver Ford
@OJFord
Thanks, that was exactly what I was screwing up :)
Oliver Ford
@OJFord
@mcollina Is registerOption required even for expected incoming headers? Trying to implement a 'terminate observation' request to use instead of 'finish' event per draft-ietf-core-observe-16 - but I seem to not receive the header at all?
Matteo Collina
@mcollina
Yes it is.
Oliver Ford
@OJFord

Thanks. Issue I'm having is that 'finish' seems to fire after ack packets dropped, but other end is still expecting notifications. Worked around this as above - but then I get an error when I "write after end", if I write after 'finish'.

Not sure how this happens, because the default 'finish' listener doesn't seem to end. Any idea?

Matteo Collina
@mcollina
@OJFord can you open an issue with an example on how to reproduce?
Oliver Ford
@OJFord
@mcollina I'll try and get something minimal later. Essentially it's just res.on('finish', function(){ res.write() }) - i.e. I don't end but the event seems to.
Drasko DRASKOVIC
@drasko
@mcollina is there any CoAP arouter similar to Express? Idea is to ease app development by calling callbacks simimlar to express method, depending what by what route REQ is coming from.
Drasko DRASKOVIC
@drasko
Looks like this can do the job: https://github.com/mafintosh/router. Do you agree?
Matteo Collina
@mcollina
Probably, give it a spin and send an update in the README for that!
Drasko DRASKOVIC
@drasko
Yep, OK. First tests look OK.
Oliver Ford
@OJFord

@mcollina Not sure how I missed this previously - but my complaints above are based on observation not supporting draft 16, and your readme clearly states it implements draft 11.. which doesn't make mention of it.. D'oh!

Any interest in updating it? I think it's pretty useful - because I consistently have the following problem:

  • A makes GET Obs request to B, who runs node-coap
  • B writes updates
  • A stops ack'ing
  • B fires 'finish' event
  • A still thinks it's observing (after stopping acks "for some reason")

The problem is that B can't say "hey, A, you need to start again". What I'd like, and D16 allows, is for B to keep writing, not caring whether A acks or not. Termination would occur only when A makes a GET Obs request with the Observe option set to 1 instead of 0.

I think the only change needed should be to stop the 'finish' event from closing the stream. Then if the present behaviour is desired, we need only res.end() when the event happens.

Oliver Ford
@OJFord
Actually, I'm not sure I understand what observable 'finish' is supposed to do, since according to node spec the event happens after an .end and flush. So does node-coap add that it'll also happen on 247s ack timeout, or instead?
Matteo Collina
@mcollina
@OJFord would you mind sending a PR that updates the library to draft 16? I'm very low bandwidth at the moment, and it would be awesome if you could help me developing it!
@OJFord on your last question, I don't remember :(. I think it should be called after the last message has been acked. If not, we would probably need to fix it.
Oliver Ford
@OJFord
@mcollina I'll try to take a look next week, but I don't have the experience to warrant any promises!
Matteo Collina
@mcollina
:)
Justas Ažna
@reederz
P
dodekaeder
@dodekaeder

Hey there.

I've a question or actually it's an idea.

My idea is to operate a single LED(with ws2812 driver) backed by an NodeMCU devkit(esp8266) with the corresponding NodeMCU firmware moduls
for CoAP and ws2812. This "thing" should get a request from a Raspberry Pi running Node.js with your node-coap libary serving a request client.
Further there will be an webbrowser interface where node-coap should act as an http-coap proxy.
It should simply take a query to the ws2812 modul via udp/coap http://nodemcu.readthedocs.org/en/dev/en/modules/ws2812/

It seems to me that, with a little effort, it should be possible to realize this project relativly easy.

Do you agree to my conclusion?

Later there should be some more of this single backed leds which all should get request from the pi.

Now... As I'am more a diy-guy than a professional developer I really need some community backup.

Do you know some community where I could find people working on things like this?

And are you willing to help me understand node-coap :D

thx in advance

(to understand node-coap) e.g., how a node-coap set up should look like to achieve a base for the pi.
Matteo Collina
@mcollina
sorry @dodekaeder, I don't really have much time help, and in fact I've just noticed your message :(
David Lewis
@davidarmstronglewis
Hey, so I’m using your node-coap library to do some IoT stuff and I’ve come into an issue which you may be able to clear up for me. On your github page, your documentation states that sending OutgoingMessages defaults to a "confirmable: true” state, but when I console.log the OutgoingMessage, the OutgoingMessage._packet.confirmable property is false. Passing in confirmable: true as part of the coap.request({..}) constructor instead sets the OutgoingMessage.url.confirmable to true, leaving the _packet.confirmable: false. Any advice you could impart on this distinction I’d really appreciate.
Matteo Collina
@mcollina
@lewisinc I don't have a clue, can you please open an issue on the repo with instructions to replicate.
you issue, and we will have a look
David Lewis
@davidarmstronglewis
Fair enough. Most of the software I’m testing is in-house, so I don’t have a way for you to replicate it. Thanks anyways :), and thanks for writing this library. It’s been a huge help.
Matteo Collina
@mcollina
Thanks!
Brandon Smith
@BrandonSmith
I saw this PR thread over at coap-cli about registering options. Seems coap.registerOption is a work in progress?
I'm leveraging node-coap in an app... would I just not worry about a "friendly" name for the option and just register like... coap.registerOption("3003", toBinary, toString) ??
Brandon Smith
@BrandonSmith
@mcollina Seeking clarification on node-coap API ^^
Matteo Collina
@mcollina
@BrandonSmith I am not actively developing node-coap, as I do not have time. I do not remember really. Feel free to open issues and PRs if you feel something should be changed.
Andrew Shvayka
@ashvayka
[This is self-promotion post]
Hi everyone! Me and my friends have just released open-source (Apache 2.0) IoT project that is free for commercial use.
It let you collect, visualize and analyze data from devices using MQTT, CoAP and HTTP protocols.
You can find it here: https://github.com/thingsboard/thingsboard
Node MCU sample is here: http://thingsboard.io/docs/samples/nodemcu/temperature/
Don't hesitate to star the project on github to help us spread the word.
user 786
@nailaandleeb
I had first experience with this node-coap today and simply copy paste the code given [here][https://github.com/mcollina/node-coap] but there is nothing in the docs about how to access it.i mean i have tried it by accessing it coap://localhost:5683 through browser,postman and also from other rest endpoint but dnt knw how to get response by it.
Alexandre Moreno
@moleike
Hi there, I'd like to share with you all a new implementation of the OMA LWM2M protocol using node-coap. The library has been under active development for a few months now: https://github.com/moleike/node-lwm2m
This was initially a fork from Telefonica's library, but currently is a full rewrite, with lots of new features and a more Node-ish API :smile:
Contributions and suggestions welcome!
Matteo Collina
@mcollina
Good job!
naveen marri
@naveenkumarmarri
Hi
I'm trying to implement observe functionality in my coap server.
So far, I've a coap server which gets data from sensors in cbor format with some payload.
Now I'm trying to implement observe functionality.so that, clients connecting to coap server will get notifications.
Are there any examples on how to achieve this?