-
Notifications
You must be signed in to change notification settings - Fork 36
coap-chat: a simple chat application using gCoAP #44
Conversation
To send messages use the `chat` shell command, it can be invoked as follows: | ||
|
||
``` | ||
chat <destination> <nickname> <message> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh... I know this takes a little away from the simplicity at least implementation-wise, but maybe do a connect
command that takes the <destination> <nickname>
parameters (and stores them) and just keep chat <message>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep it as simple as possible, introducing another command would complicate the work flow. Also connect
might imply or suggest functionality that is not there. Also you typically want to chat with different user (that is here destination addresses) and not only one specific, okay you might simply use ff02::1
...
But again, I aimed for simplicity - for a real chat application you might want to have chat rooms, user discovery and lists and more, but that would also blow up the application.
This whole thing is a side-product of a small school project, where pupils (with no C experience) were introduced to IoT and RIOT - that's why the main goal also was to keep the code simple and with minimal LOCs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for the clarification. Then I'm for now fine with the PR as is, but maybe you want to introduce DNS, so the pupils don't need to type (rather non-descript) IPv6 addresses? For the application this would only mean maybe 5 more lines (using sock_dns
), but of course a little bit more configuration in the backend (configuring the nodes' names, setting RAs to distribute the DNS server, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I'd rather not - as you already state it requires infrastructure (DNS Server) and setup.
During the school project we only had a couple of RIOT nodes (at first) and they send messages via link-local addresses and link-local multicast (ff02::1
) - which might not be very IoT'ish but at least they had fun 😉
Later we added a Raspberry Pi (with crosscoap) which forwarded all multicast messages to a webserver backend where all message were put into log and could be access via a webpage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and in the end you still can use IPv6 addresses as a fallback)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Just a suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(gnarf, why does GitHub not live-update a page -.-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the suggestion in the documentation to use ff02::1, which simplifies testing when there are only two nodes.
I uncrustified and remove trailing whitespaces. |
Nice idea! I think it works well with gcoap since an endpoint is both client and server. I just took a quick look at the code, and the implementation uses gcoap as I would expect. I'll play with it in the next couple of days and provide some specific feedback. |
Cool @kb2ma, I started this by using RIOTs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments in the code are all minor. Runs fine in native and on samr21-xpro. On my workstation, either pyterm or the shell don't recognize a carriage return when the line gets long. As a result the message does not get sent until I enter another command on top of the original.
It would be nice to overcome the line length problem. You could enhance the app to use the block-wise extension to send a long line. That would be a nice demo.
Besides that, I'll wait to hear back from you. It seems to me like the app is 'good enough' for approval once we talk through the comments.
To send messages use the `chat` shell command, it can be invoked as follows: | ||
|
||
``` | ||
chat <destination> <nickname> <message> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the suggestion in the documentation to use ff02::1, which simplifies testing when there are only two nodes.
int chat(int argc, char **argv) | ||
{ | ||
if (argc < 4) { | ||
puts("usage: chat <addr> <nick> <msg>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could note that you can specify the interface with <addr>.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll put something in the README
ACK, please squash. I don't see any update for the interface for an address, but that's not worth holding this up. |
This application allows to send (small) messages via CoAP to any destination address. To chat locally you may use `ff02::1` to reach neighbouring nodes, or chat directly using unicast addresses. The application provides a distinct shell command `chat` but also brings standard shell commands like `ifconfig` to show a nodes IP addresses.
Looks good, let's go! |
coap-chat: a simple chat application using gCoAP
This application allows to send (small) messages via CoAP to any
destination address. To chat locally you may use
ff02::1
to reachneighbouring nodes, or chat directly using unicast addresses. The
application provides a distinct shell command
chat
but also bringsstandard shell commands like
ifconfig
to show a nodes IP addresses.