ipc-framework 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ipc_framework-1.0.0/LICENSE +21 -0
- ipc_framework-1.0.0/MANIFEST.in +21 -0
- ipc_framework-1.0.0/PKG-INFO +512 -0
- ipc_framework-1.0.0/README.md +467 -0
- ipc_framework-1.0.0/examples/__init__.py +1 -0
- ipc_framework-1.0.0/examples/basic_server.py +209 -0
- ipc_framework-1.0.0/examples/chat_client.py +168 -0
- ipc_framework-1.0.0/examples/file_client.py +211 -0
- ipc_framework-1.0.0/examples/monitoring_client.py +252 -0
- ipc_framework-1.0.0/ipc_framework/__init__.py +28 -0
- ipc_framework-1.0.0/ipc_framework/client.py +274 -0
- ipc_framework-1.0.0/ipc_framework/core.py +353 -0
- ipc_framework-1.0.0/ipc_framework/demo.py +268 -0
- ipc_framework-1.0.0/ipc_framework/examples/__init__.py +13 -0
- ipc_framework-1.0.0/ipc_framework/examples/basic_server.py +209 -0
- ipc_framework-1.0.0/ipc_framework/examples/chat_client.py +168 -0
- ipc_framework-1.0.0/ipc_framework/examples/file_client.py +211 -0
- ipc_framework-1.0.0/ipc_framework/examples/monitoring_client.py +252 -0
- ipc_framework-1.0.0/ipc_framework/exceptions.py +43 -0
- ipc_framework-1.0.0/ipc_framework/py.typed +2 -0
- ipc_framework-1.0.0/ipc_framework/server.py +298 -0
- ipc_framework-1.0.0/ipc_framework.egg-info/PKG-INFO +512 -0
- ipc_framework-1.0.0/ipc_framework.egg-info/SOURCES.txt +32 -0
- ipc_framework-1.0.0/ipc_framework.egg-info/dependency_links.txt +1 -0
- ipc_framework-1.0.0/ipc_framework.egg-info/entry_points.txt +6 -0
- ipc_framework-1.0.0/ipc_framework.egg-info/not-zip-safe +1 -0
- ipc_framework-1.0.0/ipc_framework.egg-info/requires.txt +13 -0
- ipc_framework-1.0.0/ipc_framework.egg-info/top_level.txt +1 -0
- ipc_framework-1.0.0/pyproject.toml +93 -0
- ipc_framework-1.0.0/requirements.txt +9 -0
- ipc_framework-1.0.0/setup.cfg +57 -0
- ipc_framework-1.0.0/setup.py +46 -0
- ipc_framework-1.0.0/tests/test_basic.py +115 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 IPC Framework Team
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Include the README and other documentation
|
2
|
+
include README.md
|
3
|
+
include LICENSE
|
4
|
+
include requirements.txt
|
5
|
+
include pyproject.toml
|
6
|
+
|
7
|
+
# Include example scripts
|
8
|
+
recursive-include examples *.py
|
9
|
+
|
10
|
+
# Include package data
|
11
|
+
include ipc_framework/py.typed
|
12
|
+
|
13
|
+
# Exclude development and build files
|
14
|
+
exclude demo.py
|
15
|
+
exclude .gitignore
|
16
|
+
exclude *.yaml
|
17
|
+
exclude *.yml
|
18
|
+
global-exclude __pycache__
|
19
|
+
global-exclude *.py[co]
|
20
|
+
global-exclude *.so
|
21
|
+
global-exclude .DS_Store
|
@@ -0,0 +1,512 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: ipc-framework
|
3
|
+
Version: 1.0.0
|
4
|
+
Summary: Efficient Inter-Process Communication Framework with hierarchical application and channel management
|
5
|
+
Home-page: https://github.com/ifesol/ipc-framework
|
6
|
+
Author: IPC Framework Team
|
7
|
+
Author-email: ifesol <ifesol@example.com>
|
8
|
+
Maintainer-email: ifesol <ifesol@example.com>
|
9
|
+
License: MIT
|
10
|
+
Project-URL: Homepage, https://github.com/ifesol/ipc-framework
|
11
|
+
Project-URL: Documentation, https://github.com/ifesol/ipc-framework#readme
|
12
|
+
Project-URL: Repository, https://github.com/ifesol/ipc-framework.git
|
13
|
+
Project-URL: Bug Tracker, https://github.com/ifesol/ipc-framework/issues
|
14
|
+
Keywords: ipc,communication,networking,client-server,messaging
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
16
|
+
Classifier: Intended Audience :: Developers
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
18
|
+
Classifier: Topic :: System :: Networking
|
19
|
+
Classifier: License :: OSI Approved :: MIT License
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
21
|
+
Classifier: Programming Language :: Python :: 3.7
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
27
|
+
Classifier: Operating System :: OS Independent
|
28
|
+
Requires-Python: >=3.7
|
29
|
+
Description-Content-Type: text/markdown
|
30
|
+
License-File: LICENSE
|
31
|
+
Provides-Extra: examples
|
32
|
+
Requires-Dist: psutil>=5.8.0; extra == "examples"
|
33
|
+
Provides-Extra: dev
|
34
|
+
Requires-Dist: pytest>=6.0.0; extra == "dev"
|
35
|
+
Requires-Dist: black>=21.0.0; extra == "dev"
|
36
|
+
Requires-Dist: flake8>=3.8.0; extra == "dev"
|
37
|
+
Requires-Dist: mypy>=0.910; extra == "dev"
|
38
|
+
Requires-Dist: isort>=5.0.0; extra == "dev"
|
39
|
+
Provides-Extra: all
|
40
|
+
Requires-Dist: ipc-framework[dev,examples]; extra == "all"
|
41
|
+
Dynamic: author
|
42
|
+
Dynamic: home-page
|
43
|
+
Dynamic: license-file
|
44
|
+
Dynamic: requires-python
|
45
|
+
|
46
|
+
# IPC Framework JS
|
47
|
+
|
48
|
+
[](https://www.npmjs.com/package/ipc-framework-js)
|
49
|
+
[](https://opensource.org/licenses/MIT)
|
50
|
+
|
51
|
+
A powerful, TypeScript-first Inter-Process Communication framework for JavaScript/TypeScript applications. Works seamlessly in both **Node.js** (backend) and **browser** (frontend) environments using WebSockets.
|
52
|
+
|
53
|
+
## 🚀 Features
|
54
|
+
|
55
|
+
- **🌐 Universal**: Works in both Node.js and browser environments
|
56
|
+
- **📝 TypeScript First**: Full TypeScript support with comprehensive type definitions
|
57
|
+
- **🔄 Real-time**: WebSocket-based communication for instant message delivery
|
58
|
+
- **🏗️ Hierarchical**: Organized by applications → channels → messages
|
59
|
+
- **📡 Multiple Message Types**: Request/Response, Pub/Sub, Notifications
|
60
|
+
- **🔗 Auto-reconnection**: Built-in reconnection logic with exponential backoff
|
61
|
+
- **💗 Heartbeat**: Keep-alive mechanism to maintain connections
|
62
|
+
- **🎯 Type-safe**: Fully typed APIs for better developer experience
|
63
|
+
- **📦 Dual Package**: Separate builds for Node.js and browsers
|
64
|
+
|
65
|
+
## 📦 Installation
|
66
|
+
|
67
|
+
```bash
|
68
|
+
npm install ipc-framework-js
|
69
|
+
```
|
70
|
+
|
71
|
+
For Node.js usage, you'll also need the WebSocket library:
|
72
|
+
|
73
|
+
```bash
|
74
|
+
npm install ws
|
75
|
+
npm install --save-dev @types/ws # If using TypeScript
|
76
|
+
```
|
77
|
+
|
78
|
+
## 🎯 Quick Start
|
79
|
+
|
80
|
+
### Server (Node.js)
|
81
|
+
|
82
|
+
```typescript
|
83
|
+
import { IPCServer, MessageType } from 'ipc-framework-js';
|
84
|
+
|
85
|
+
// Create server
|
86
|
+
const server = new IPCServer({
|
87
|
+
host: 'localhost',
|
88
|
+
port: 8888,
|
89
|
+
maxConnections: 100
|
90
|
+
});
|
91
|
+
|
92
|
+
// Create application and channels
|
93
|
+
const chatApp = server.createApplication('chat_app', 'Chat Application');
|
94
|
+
const generalChannel = chatApp.createChannel('general');
|
95
|
+
|
96
|
+
// Set up message handler
|
97
|
+
generalChannel.setHandler(MessageType.REQUEST, (message) => {
|
98
|
+
console.log('Received message:', message.payload);
|
99
|
+
|
100
|
+
// Broadcast to all subscribers
|
101
|
+
server.handlePublish(message, generalChannel);
|
102
|
+
});
|
103
|
+
|
104
|
+
// Start server
|
105
|
+
await server.start();
|
106
|
+
console.log('🚀 IPC Server started on ws://localhost:8888');
|
107
|
+
```
|
108
|
+
|
109
|
+
### Client (Node.js)
|
110
|
+
|
111
|
+
```typescript
|
112
|
+
import { IPCClient, MessageType } from 'ipc-framework-js';
|
113
|
+
|
114
|
+
// Create client
|
115
|
+
const client = new IPCClient('chat_app', {
|
116
|
+
host: 'localhost',
|
117
|
+
port: 8888,
|
118
|
+
reconnectAttempts: 5
|
119
|
+
});
|
120
|
+
|
121
|
+
// Connect
|
122
|
+
await client.connect();
|
123
|
+
|
124
|
+
// Subscribe to messages
|
125
|
+
client.subscribe('general', (message) => {
|
126
|
+
console.log('Received:', message.payload);
|
127
|
+
});
|
128
|
+
|
129
|
+
// Send message
|
130
|
+
client.request('general', {
|
131
|
+
username: 'john',
|
132
|
+
text: 'Hello World!'
|
133
|
+
});
|
134
|
+
```
|
135
|
+
|
136
|
+
### Client (Browser)
|
137
|
+
|
138
|
+
```html
|
139
|
+
<!DOCTYPE html>
|
140
|
+
<html>
|
141
|
+
<head>
|
142
|
+
<title>IPC Client</title>
|
143
|
+
<script src="./node_modules/ipc-framework-js/dist/browser/index.js"></script>
|
144
|
+
</head>
|
145
|
+
<body>
|
146
|
+
<script>
|
147
|
+
// Create client
|
148
|
+
const client = new IPCFramework.IPCClient('chat_app', {
|
149
|
+
host: 'localhost',
|
150
|
+
port: 8888
|
151
|
+
});
|
152
|
+
|
153
|
+
// Connect and use
|
154
|
+
client.connect().then(() => {
|
155
|
+
console.log('Connected!');
|
156
|
+
|
157
|
+
// Subscribe to messages
|
158
|
+
client.subscribe('general', (message) => {
|
159
|
+
console.log('Received:', message.payload);
|
160
|
+
});
|
161
|
+
|
162
|
+
// Send message
|
163
|
+
client.request('general', {
|
164
|
+
username: 'browser_user',
|
165
|
+
text: 'Hello from browser!'
|
166
|
+
});
|
167
|
+
});
|
168
|
+
</script>
|
169
|
+
</body>
|
170
|
+
</html>
|
171
|
+
```
|
172
|
+
|
173
|
+
## 📚 API Reference
|
174
|
+
|
175
|
+
### Server API
|
176
|
+
|
177
|
+
#### `IPCServer`
|
178
|
+
|
179
|
+
```typescript
|
180
|
+
class IPCServer {
|
181
|
+
constructor(options?: IServerOptions)
|
182
|
+
|
183
|
+
// Server lifecycle
|
184
|
+
async start(): Promise<void>
|
185
|
+
async stop(): Promise<void>
|
186
|
+
|
187
|
+
// Application management
|
188
|
+
createApplication(appId: string, name?: string): Application
|
189
|
+
getApplication(appId: string): Application | undefined
|
190
|
+
removeApplication(appId: string): boolean
|
191
|
+
|
192
|
+
// Statistics
|
193
|
+
getStats(): IServerStats
|
194
|
+
listApplications(): Map<string, any>
|
195
|
+
}
|
196
|
+
```
|
197
|
+
|
198
|
+
#### Server Options
|
199
|
+
|
200
|
+
```typescript
|
201
|
+
interface IServerOptions {
|
202
|
+
host?: string; // Default: 'localhost'
|
203
|
+
port?: number; // Default: 8888
|
204
|
+
maxConnections?: number; // Default: 100
|
205
|
+
heartbeatInterval?: number; // Default: 30000ms
|
206
|
+
}
|
207
|
+
```
|
208
|
+
|
209
|
+
### Client API
|
210
|
+
|
211
|
+
#### `IPCClient`
|
212
|
+
|
213
|
+
```typescript
|
214
|
+
class IPCClient {
|
215
|
+
constructor(appId: string, options?: IClientOptions)
|
216
|
+
|
217
|
+
// Connection management
|
218
|
+
async connect(): Promise<boolean>
|
219
|
+
disconnect(): void
|
220
|
+
isConnected(): boolean
|
221
|
+
|
222
|
+
// Messaging
|
223
|
+
subscribe(channelId: string, handler?: MessageHandler): boolean
|
224
|
+
unsubscribe(channelId: string): boolean
|
225
|
+
request(channelId: string, data: any): string
|
226
|
+
notify(channelId: string, data: any): string
|
227
|
+
publish(channelId: string, data: any): string
|
228
|
+
|
229
|
+
// Advanced messaging
|
230
|
+
async sendRequest(channelId: string, data: any, timeout?: number): Promise<Message | null>
|
231
|
+
sendRequestAsync(channelId: string, data: any, callback: Function): string
|
232
|
+
|
233
|
+
// Utilities
|
234
|
+
async ping(timeout?: number): Promise<boolean>
|
235
|
+
getConnectionInfo(): IConnectionInfo
|
236
|
+
|
237
|
+
// Event handlers
|
238
|
+
onConnected(handler: () => void): void
|
239
|
+
onDisconnected(handler: () => void): void
|
240
|
+
onError(handler: (error: Error) => void): void
|
241
|
+
}
|
242
|
+
```
|
243
|
+
|
244
|
+
#### Client Options
|
245
|
+
|
246
|
+
```typescript
|
247
|
+
interface IClientOptions {
|
248
|
+
host?: string; // Default: 'localhost'
|
249
|
+
port?: number; // Default: 8888
|
250
|
+
connectionTimeout?: number; // Default: 10000ms
|
251
|
+
reconnectAttempts?: number; // Default: 5
|
252
|
+
reconnectDelay?: number; // Default: 1000ms
|
253
|
+
heartbeatInterval?: number; // Default: 30000ms
|
254
|
+
}
|
255
|
+
```
|
256
|
+
|
257
|
+
### Message Types
|
258
|
+
|
259
|
+
```typescript
|
260
|
+
enum MessageType {
|
261
|
+
REQUEST = 'request', // Request-response pattern
|
262
|
+
RESPONSE = 'response', // Response to a request
|
263
|
+
NOTIFICATION = 'notification', // One-way message
|
264
|
+
SUBSCRIBE = 'subscribe', // Subscribe to channel
|
265
|
+
UNSUBSCRIBE = 'unsubscribe', // Unsubscribe from channel
|
266
|
+
PUBLISH = 'publish' // Publish to subscribers
|
267
|
+
}
|
268
|
+
```
|
269
|
+
|
270
|
+
### Core Classes
|
271
|
+
|
272
|
+
#### `Message`
|
273
|
+
|
274
|
+
```typescript
|
275
|
+
class Message {
|
276
|
+
readonly messageId: string;
|
277
|
+
readonly appId: string;
|
278
|
+
readonly channelId: string;
|
279
|
+
readonly messageType: MessageType;
|
280
|
+
readonly payload: any;
|
281
|
+
readonly timestamp: number;
|
282
|
+
readonly replyTo?: string;
|
283
|
+
|
284
|
+
// Serialization
|
285
|
+
toJSON(): string
|
286
|
+
toObject(): IMessage
|
287
|
+
|
288
|
+
// Static methods
|
289
|
+
static fromJSON(json: string): Message
|
290
|
+
static fromObject(data: IMessage): Message
|
291
|
+
|
292
|
+
// Utility methods
|
293
|
+
createResponse(payload: any): Message
|
294
|
+
isResponse(): boolean
|
295
|
+
isRequest(): boolean
|
296
|
+
// ... more utility methods
|
297
|
+
}
|
298
|
+
```
|
299
|
+
|
300
|
+
#### `Application`
|
301
|
+
|
302
|
+
```typescript
|
303
|
+
class Application {
|
304
|
+
readonly appId: string;
|
305
|
+
readonly name: string;
|
306
|
+
readonly createdAt: number;
|
307
|
+
|
308
|
+
// Channel management
|
309
|
+
createChannel(channelId: string): Channel
|
310
|
+
getChannel(channelId: string): Channel | undefined
|
311
|
+
removeChannel(channelId: string): boolean
|
312
|
+
listChannels(): string[]
|
313
|
+
|
314
|
+
// Statistics
|
315
|
+
getStats(): IApplicationStats
|
316
|
+
getTotalConnectionCount(): number
|
317
|
+
}
|
318
|
+
```
|
319
|
+
|
320
|
+
#### `Channel`
|
321
|
+
|
322
|
+
```typescript
|
323
|
+
class Channel {
|
324
|
+
readonly channelId: string;
|
325
|
+
readonly appId: string;
|
326
|
+
readonly createdAt: number;
|
327
|
+
|
328
|
+
// Subscriber management
|
329
|
+
addSubscriber(connectionId: string): void
|
330
|
+
removeSubscriber(connectionId: string): boolean
|
331
|
+
getSubscribers(): string[]
|
332
|
+
|
333
|
+
// Message handling
|
334
|
+
setHandler(messageType: MessageType, handler: MessageHandler): void
|
335
|
+
removeHandler(messageType: MessageType): boolean
|
336
|
+
executeHandler(message: Message): Promise<boolean>
|
337
|
+
}
|
338
|
+
```
|
339
|
+
|
340
|
+
## 🏗️ Architecture
|
341
|
+
|
342
|
+
The IPC Framework follows a hierarchical structure:
|
343
|
+
|
344
|
+
```
|
345
|
+
Server
|
346
|
+
├── Application (chat_app)
|
347
|
+
│ ├── Channel (general)
|
348
|
+
│ ├── Channel (tech_talk)
|
349
|
+
│ └── Channel (random)
|
350
|
+
├── Application (file_share)
|
351
|
+
│ ├── Channel (upload)
|
352
|
+
│ └── Channel (download)
|
353
|
+
└── Application (monitoring)
|
354
|
+
├── Channel (metrics)
|
355
|
+
└── Channel (alerts)
|
356
|
+
```
|
357
|
+
|
358
|
+
### Message Flow
|
359
|
+
|
360
|
+
1. **Client connects** to server with an `appId`
|
361
|
+
2. **Client subscribes** to channels within that application
|
362
|
+
3. **Messages are routed** based on `appId` → `channelId`
|
363
|
+
4. **Handlers process** messages based on message type
|
364
|
+
5. **Responses/broadcasts** are sent back to relevant subscribers
|
365
|
+
|
366
|
+
## 🛠️ Development
|
367
|
+
|
368
|
+
### Building
|
369
|
+
|
370
|
+
```bash
|
371
|
+
# Install dependencies
|
372
|
+
npm install
|
373
|
+
|
374
|
+
# Build for all environments
|
375
|
+
npm run build
|
376
|
+
|
377
|
+
# Build for specific environments
|
378
|
+
npm run build:node # Node.js build
|
379
|
+
npm run build:browser # Browser build
|
380
|
+
npm run build:types # TypeScript declarations
|
381
|
+
```
|
382
|
+
|
383
|
+
### Development Mode
|
384
|
+
|
385
|
+
```bash
|
386
|
+
# Watch mode for development
|
387
|
+
npm run dev
|
388
|
+
|
389
|
+
# Run examples
|
390
|
+
npm run example:server # Start example server
|
391
|
+
npm run example:chat # Start chat client
|
392
|
+
npm run example:browser # Start browser demo
|
393
|
+
```
|
394
|
+
|
395
|
+
### Testing
|
396
|
+
|
397
|
+
```bash
|
398
|
+
# Run tests
|
399
|
+
npm test
|
400
|
+
|
401
|
+
# Watch mode
|
402
|
+
npm run test:watch
|
403
|
+
```
|
404
|
+
|
405
|
+
## 📋 Examples
|
406
|
+
|
407
|
+
### Chat Application
|
408
|
+
|
409
|
+
Complete chat application with multiple channels:
|
410
|
+
|
411
|
+
- **Server**: `examples/node/server.js`
|
412
|
+
- **Client**: `examples/node/chat-client.js`
|
413
|
+
- **Browser**: `examples/browser/index.html`
|
414
|
+
|
415
|
+
### File Sharing
|
416
|
+
|
417
|
+
File upload/download with progress tracking:
|
418
|
+
|
419
|
+
```bash
|
420
|
+
# Terminal 1: Start server
|
421
|
+
npm run example:server
|
422
|
+
|
423
|
+
# Terminal 2: Start file client
|
424
|
+
node examples/node/file-client.js
|
425
|
+
```
|
426
|
+
|
427
|
+
### System Monitoring
|
428
|
+
|
429
|
+
Real-time metrics and alerting:
|
430
|
+
|
431
|
+
```bash
|
432
|
+
# Start monitoring client
|
433
|
+
node examples/node/monitoring-client.js
|
434
|
+
```
|
435
|
+
|
436
|
+
## 🌐 Browser Usage
|
437
|
+
|
438
|
+
### ES Modules (Modern)
|
439
|
+
|
440
|
+
```html
|
441
|
+
<script type="module">
|
442
|
+
import { IPCClient } from './node_modules/ipc-framework-js/dist/browser/index.esm.js';
|
443
|
+
|
444
|
+
const client = new IPCClient('my_app');
|
445
|
+
// Use client...
|
446
|
+
</script>
|
447
|
+
```
|
448
|
+
|
449
|
+
### UMD (Universal)
|
450
|
+
|
451
|
+
```html
|
452
|
+
<script src="./node_modules/ipc-framework-js/dist/browser/index.js"></script>
|
453
|
+
<script>
|
454
|
+
const client = new IPCFramework.IPCClient('my_app');
|
455
|
+
// Use client...
|
456
|
+
</script>
|
457
|
+
```
|
458
|
+
|
459
|
+
### With Bundlers
|
460
|
+
|
461
|
+
Works with Webpack, Rollup, Vite, etc.:
|
462
|
+
|
463
|
+
```typescript
|
464
|
+
import { IPCClient } from 'ipc-framework-js';
|
465
|
+
|
466
|
+
// Bundler will automatically use browser build
|
467
|
+
const client = new IPCClient('my_app');
|
468
|
+
```
|
469
|
+
|
470
|
+
## 🔧 Configuration
|
471
|
+
|
472
|
+
### TypeScript Configuration
|
473
|
+
|
474
|
+
```json
|
475
|
+
{
|
476
|
+
"compilerOptions": {
|
477
|
+
"moduleResolution": "node",
|
478
|
+
"esModuleInterop": true,
|
479
|
+
"allowSyntheticDefaultImports": true
|
480
|
+
}
|
481
|
+
}
|
482
|
+
```
|
483
|
+
|
484
|
+
### Environment Detection
|
485
|
+
|
486
|
+
The library automatically detects the environment and uses appropriate WebSocket implementation:
|
487
|
+
|
488
|
+
- **Node.js**: Uses `ws` package
|
489
|
+
- **Browser**: Uses native `WebSocket`
|
490
|
+
|
491
|
+
## 🤝 Contributing
|
492
|
+
|
493
|
+
1. Fork the repository
|
494
|
+
2. Create feature branch: `git checkout -b feature-name`
|
495
|
+
3. Commit changes: `git commit -am 'Add feature'`
|
496
|
+
4. Push to branch: `git push origin feature-name`
|
497
|
+
5. Submit pull request
|
498
|
+
|
499
|
+
## 📄 License
|
500
|
+
|
501
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
502
|
+
|
503
|
+
## 🔗 Links
|
504
|
+
|
505
|
+
- [NPM Package](https://www.npmjs.com/package/ipc-framework-js)
|
506
|
+
- [GitHub Repository](https://github.com/your-username/ipc-framework-js)
|
507
|
+
- [Documentation](https://github.com/your-username/ipc-framework-js#readme)
|
508
|
+
- [Issues](https://github.com/your-username/ipc-framework-js/issues)
|
509
|
+
|
510
|
+
## 🙏 Acknowledgments
|
511
|
+
|
512
|
+
Inspired by modern real-time communication needs and built with developer experience in mind.
|