Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ticaki committed Dec 19, 2023
1 parent dcca9a6 commit ae8766e
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.*/
!.vscode/
!.github/

mydb/
*.code-workspace
node_modules
nbproject
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Was geht:
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
* (ticaki) Added: Mqtt Server with file db

### 0.0.2 (2023-12-18)
* (ticaki) initial release

Expand Down
10 changes: 5 additions & 5 deletions build/lib/mqtt.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/lib/mqtt.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed mydb/000060.log
Binary file not shown.
2 changes: 1 addition & 1 deletion mydb/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000058
MANIFEST-000064
10 changes: 5 additions & 5 deletions mydb/LOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
2023/12/19-23:44:26.994375 7fd287bff6c0 Recovering log #56
2023/12/19-23:44:26.994462 7fd287bff6c0 Level-0 table #59: started
2023/12/19-23:44:27.007904 7fd287bff6c0 Level-0 table #59: 880 bytes OK
2023/12/19-23:44:27.011417 7fd287bff6c0 Delete type=3 #54
2023/12/19-23:44:27.011491 7fd287bff6c0 Delete type=0 #56
2023/12/20-00:34:58.856057 7faa6bbff6c0 Recovering log #63
2023/12/20-00:34:58.856183 7faa6bbff6c0 Level-0 table #65: started
2023/12/20-00:34:58.860421 7faa6bbff6c0 Level-0 table #65: 3455 bytes OK
2023/12/20-00:34:58.864348 7faa6bbff6c0 Delete type=3 #61
2023/12/20-00:34:58.864407 7faa6bbff6c0 Delete type=0 #63
19 changes: 5 additions & 14 deletions mydb/LOG.old
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
2023/12/19-23:43:04.386992 7f1f723ff6c0 Recovering log #53
2023/12/19-23:43:04.387100 7f1f723ff6c0 Level-0 table #55: started
2023/12/19-23:43:04.412023 7f1f723ff6c0 Level-0 table #55: 866 bytes OK
2023/12/19-23:43:04.415774 7f1f723ff6c0 Delete type=0 #53
2023/12/19-23:43:04.415830 7f1f723ff6c0 Delete type=3 #51
2023/12/19-23:43:04.420782 7f1f5bfff6c0 Compacting 4@0 + 1@1 files
2023/12/19-23:43:04.427971 7f1f5bfff6c0 Generated table #57@0: 29 keys, 3443 bytes
2023/12/19-23:43:04.428110 7f1f5bfff6c0 Compacted 4@0 + 1@1 files => 3443 bytes
2023/12/19-23:43:04.429507 7f1f5bfff6c0 compacted to: files[ 0 1 0 0 0 0 0 ]
2023/12/19-23:43:04.429775 7f1f5bfff6c0 Delete type=2 #55
2023/12/19-23:43:04.429989 7f1f5bfff6c0 Delete type=2 #44
2023/12/19-23:43:04.430200 7f1f5bfff6c0 Delete type=2 #49
2023/12/19-23:43:04.430383 7f1f5bfff6c0 Delete type=2 #52
2023/12/19-23:43:04.430571 7f1f5bfff6c0 Delete type=2 #46
2023/12/20-00:30:00.814059 7f69c8fff6c0 Recovering log #60
2023/12/20-00:30:00.814237 7f69c8fff6c0 Level-0 table #62: started
2023/12/20-00:30:00.823427 7f69c8fff6c0 Level-0 table #62: 880 bytes OK
2023/12/20-00:30:00.827201 7f69c8fff6c0 Delete type=3 #58
2023/12/20-00:30:00.827267 7f69c8fff6c0 Delete type=0 #60
Binary file removed mydb/MANIFEST-000058
Binary file not shown.
10 changes: 5 additions & 5 deletions src/lib/mqtt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class MQTTClientClass extends BaseClass {
super(adapter, 'mqttClient');
this.client = mqtt.connect(`mqtt://${ip}:${port}`, { username: username, password: password });
this.client.on('connect', () => {
this.log.info(`connection is active.`);
this.log.info(`Connection is active.`);
this.adapter.setState('info.connection', true, true);
this.client.subscribe('espresense/#', (err) => {
if (err) {
Expand All @@ -35,7 +35,7 @@ export class MQTTClientClass extends BaseClass {

this.client.on('close', () => {
this.adapter.setState('info.connection', false, true);
this.log.info(`connection is closed.`);
this.log.info(`Connection is closed.`);
});

this.client.on('message', (topic, message) => {
Expand Down Expand Up @@ -89,7 +89,7 @@ export class MQTTServerClass extends BaseClass {
this.server = createServer(this.aedes.handle);

this.server.listen(port, () => {
this.log.debug('server started and listening on port ', String(port));
this.log.info(`Started and listening on port ${port}`);
});
this.aedes.authenticate = (
client: Client,
Expand All @@ -98,8 +98,8 @@ export class MQTTServerClass extends BaseClass {
callback: any,
) => {
const confirm = username === un && password == pw!.toString();
if (!confirm) this.log.warn('MQTT client login denied. User name or password wrong!');
else this.log.debug('MQTT client login successful.');
if (!confirm) this.log.warn(`Login denied client: ${client.id}. User name or password wrong!`);
else this.log.info(`Client ${client.id} login successful.`);
callback(null, confirm);
};
}
Expand Down

0 comments on commit ae8766e

Please sign in to comment.