You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(readme): Update README with enhanced logging details and usage examples
This commit updates the README file to include details about the enhanced logging functionality in the microstream-client SDK. It provides information on the new logLevel option, color-coded log messages, and usage examples.
Changes include:
- Addition of logLevel details in the Configuration Options section.
- Updated usage examples to demonstrate the new logging functionality.
- Improved readability and structure of the README.
This update ensures that developers have clear and comprehensive documentation on how to use the enhanced logging features in the microstream-client SDK.
Copy file name to clipboardExpand all lines: README.md
+57-26Lines changed: 57 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# MicroStream Client SDK
1
+
# MicroStream Client SDK 🚀
2
2
3
3
The client library for Microstream, a lightweight, real-time communication library for microservices. Replace REST/gRPC with WebSockets for event-driven messaging. Simplifies inter-service communication with a request-response pattern and automatic reconnection.
1.**Configuration**: The [`MicrostreamClient`](#microstreamclientoptions) is configured with the URL of the Microstream Hub, the name of your service, and the log level.
106
+
2.**Registering Handlers**: The `onRequest` method is used to register a handler for incoming requests. In this example, the handler responds to an "authenticate" event.
107
+
-**Parameters**:
108
+
-`event`: The event name to listen for.
109
+
-`handler`: The function to handle the request. It receives the request data and returns the response.
110
+
3.**Sending Requests**: The `sendRequest` method is used to send a request to another service. In this example, a request is sent to the "jwt-service" to generate a JWT for a user with ID 123.
111
+
-**Parameters**:
112
+
-`targetService`: The name of the target service.
113
+
-`event`: The event name to trigger on the target service.
114
+
-`data`: Optional data to send with the request.
115
+
-**Returns**: A promise that resolves with the response from the target service.
116
+
95
117
<hr>
96
118
97
-
## Configuration Options
119
+
## Configuration Options ⚙️
98
120
99
121
### MicrostreamClientOptions
100
122
101
123
-`hubUrl`: URL of the Microstream Hub.
102
124
-`serviceName`: Name of the service connecting to the hub.
103
125
-`timeout`: Timeout for requests in milliseconds (default: 5000).
104
126
-`heartbeatInterval`: Interval for sending heartbeats in milliseconds (default: 5000).
105
-
-`logLevel`: Log level for the client (default: "info").
127
+
-[`logLevel`](#log-levels-): Log level for the client (default: "info").
106
128
107
129
<hr>
108
130
109
-
## Log Levels
131
+
## Log Levels 📊
110
132
111
133
-`debug`: Log everything (useful for development).
0 commit comments