Skip to content

Commit

Permalink
docs: consistency in callback and mId (#1171)
Browse files Browse the repository at this point in the history
* docs: callback naming consistency

* docs: change mid to mId, camel case consistency
  • Loading branch information
roblan authored Oct 5, 2020
1 parent 09f412d commit 66f7de7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ Unsubscribe from a topic or topics

-------------------------------------------------------
<a name="end"></a>
### mqtt.Client#end([force], [options], [cb])
### mqtt.Client#end([force], [options], [callback])

Close the client, accepts the following options:

Expand All @@ -505,19 +505,19 @@ Close the client, accepts the following options:
* `reasonString`: representing the reason for the disconnect `string`,
* `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`,
* `serverReference`: String which can be used by the Client to identify another Server to use `string`
* `cb`: will be called when the client is closed. This parameter is
* `callback`: will be called when the client is closed. This parameter is
optional.

-------------------------------------------------------
<a name="removeOutgoingMessage"></a>
### mqtt.Client#removeOutgoingMessage(mid)
### mqtt.Client#removeOutgoingMessage(mId)

Remove a message from the outgoingStore.
The outgoing callback will be called with Error('Message removed') if the message is removed.

After this function is called, the messageId is released and becomes reusable.

* `mid`: The messageId of the message in the outgoingStore.
* `mId`: The messageId of the message in the outgoingStore.

-------------------------------------------------------
<a name="reconnect"></a>
Expand Down Expand Up @@ -715,15 +715,15 @@ import mqtt from 'mqtt';
export default () => {
const [connectionStatus, setConnectionStatus] = React.useState(false);
const [messages, setMessages] = React.useState([]);

useEffect(() => {
const client = mqtt.connect(SOME_URL);
client.on('connect', () => setConnectionStatus(true));
client.on('message', (topic, payload, packet) => {
setMessages(messages.concat(payload.toString()));
});
}, []);

return (
<>
{lastMessages.map((message) => (
Expand Down

0 comments on commit 66f7de7

Please sign in to comment.