File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33All notable changes to this project will be documented in this file.
44
5+ The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
6+ and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7+
8+ ## [ Unreleased]
9+
10+ ## [ 0.3.14] - 2025-01-13
11+
12+ ### Added
13+ - Browser support via webpack bundle
14+ - New browser entry point for direct browser usage
15+ - Example HTML file demonstrating browser usage
16+ - Source maps for better debugging
17+ - UMD bundle for CDN usage
18+
19+ ### Changed
20+ - Updated package.json to include browser field
21+ - Enhanced build process to support browser environments
22+
523## [ 0.3.10] - 2025-01-02
624
725### Changed
Original file line number Diff line number Diff line change @@ -117,6 +117,62 @@ const server = await createNostrServer(8080, {
117117});
118118```
119119
120+ ## Browser Usage
121+
122+ This library now supports direct browser usage! You can use it in your client-side applications in two ways:
123+
124+ ### Via NPM (Recommended)
125+
126+ ``` javascript
127+ import { NostrWSClient } from ' nostr-websocket-utils' ;
128+
129+ const client = new NostrWSClient ({
130+ url: ' wss://relay.damus.io' ,
131+ options: {
132+ autoReconnect: true ,
133+ maxRetries: 3
134+ }
135+ });
136+
137+ client .onMessage ((message ) => {
138+ console .log (' Received:' , message);
139+ });
140+
141+ client .connect ();
142+ ```
143+
144+ ### Via CDN
145+
146+ ``` html
147+ <script src =" https://unpkg.com/nostr-websocket-utils/dist/browser/nostr-websocket-utils.min.js" ></script >
148+ <script >
149+ const client = new NostrWebSocketUtils.NostrWSClient ({
150+ url: ' wss://relay.damus.io' ,
151+ options: {
152+ autoReconnect: true ,
153+ maxRetries: 3
154+ }
155+ });
156+
157+ client .onMessage ((message ) => {
158+ console .log (' Received:' , message);
159+ });
160+
161+ client .connect ();
162+ </script >
163+ ```
164+
165+ ### Features in Browser Environment
166+
167+ - Direct WebSocket connections to Nostr relays
168+ - Automatic reconnection handling
169+ - Message queueing
170+ - Type-safe handlers
171+ - Full compatibility with browser environments
172+ - Source maps for better debugging
173+
174+ See the ` examples/browser.html ` file for a complete example of browser usage.
175+
120176## Dependencies
121177
122178This package uses:
You can’t perform that action at this time.
0 commit comments