-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
less memory utilisation on received msgs (#79)
* less memory utilisation on received msgs making use of scatter/gather io rather than malloc * better output on examples to show whats occuring * put topic len inside cb, no change in cb size * less memory used on recv & less memcpy * dont print log for every message * retry read on interrupt
- Loading branch information
1 parent
4873680
commit c0a2714
Showing
3 changed files
with
118 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
\l ../q/mqtt.q | ||
|
||
// Initialize a counter to allow us to stop after a set number of published messages | ||
n:0 | ||
n:1 | ||
topics:`topic1`topic2 | ||
// Connect to the host | ||
//.mqtt.conn[`$"tcp://host.docker.internal:1883";`src;()!()] | ||
.mqtt.conn[`$"tcp://localhost:1883";`src;()!()] | ||
// Set up a timed message publisher | ||
.z.ts:{if[n>=199;system"t 0"]; | ||
.mqtt.pub[`topic1;string[.z.p],";","topic1_",string n]; | ||
.mqtt.pub[`topic2;string[.z.p],";","topic2_",string n]; | ||
.z.ts:{if[n>=200;0N!"Finished sending ",(string n)," messages to each topic";system"t 0"]; | ||
.mqtt.pubx[;string[.z.p],";","topic1_",string n;0;0b] each topics; | ||
n+:1} | ||
|
||
-1"Type `\\t 100` to publish a message every 100ms up to 200 messages, to stop type `\\t 0`"; | ||
-1"Configured topics: ",","sv string topics; | ||
-1"Type `\\t 100` to publish a message to each topic every 100ms (up to 200 messages), to stop type `\\t 0`"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters