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
**The server does one thing:** It accepts JSON data submitted to the endpoint and forwards it to the specified socket. It will relay _any_ data that you submit - it is up to the listening client to consume it.
24
+
25
+
You can have any number of clients listening to different sockets. In this way, you can have multiple apps listening for different events and different payloads. Purely as examples, you could have all of the following:
26
+
27
+
- An admin panel that listens on a socket named `admin-notifications`, receiving information about system events.
28
+
- An e-commerce site that listens on a socket named `sales-popups`, which displays a sale notification to visitors, similar to [Sales Pop](http://sales-pop.demo.beeketing.com/).
29
+
- A real-time chat application that listens on a socket named `chat-app`, which broadcasts user messages as they are submitted.
30
+
31
+
These are just examples - you can relay any data to any number of sockets that you wish. **The included demo page is simply an example of consuming data received from the server.** Your usage will vary.
32
+
20
33
### Goals
21
34
22
35
-[x] Add ability to limit specific socket names
@@ -26,7 +39,7 @@ A simple example of using [Node.js](https://nodejs.org/) to send Growl-style mes
26
39
-[ ] Add example with custom template and image
27
40
-[ ] Improve input validation
28
41
-[ ] Improve exception handling
29
-
-[ ] WordPress plugin to function similar to [Sales Pop](http://sales-pop.demo.beeketing.com/)
42
+
-[ ] WordPress plugin and integrations
30
43
31
44
## Installation
32
45
@@ -40,37 +53,6 @@ npm run start
40
53
```
41
54
:pushpin: For local development, you can use `npm run dev` instead to automatically reload the server as you modify and save files.
42
55
43
-
## Configuration
44
-
45
-
Configuration files are located in the `config` directory. `default.json` is used when `NODE_ENV` is not defined or where a matching environment configuration file does not exist.
46
-
47
-
### Setting Environment
48
-
49
-
If you'd like to have a different [configuration file](https://github.com/lorenwest/node-config/wiki/Configuration-Files#file-load-order/) a particular environment ("production", for example):
50
-
51
-
1. Set the environment at the command line: `export NODE_ENV=production`
52
-
2. Create a `config/production.json` file with variables from [`config/default.json`](https://github.com/dmhendricks/nodejs-simple-message-relay/blob/master/config/default.json) that you'd like to override. Example:
53
-
54
-
```json
55
-
{
56
-
"server": {
57
-
"address": "0.0.0.0"
58
-
},
59
-
"demo_page": false,
60
-
"api_keys": [
61
-
"abc123def",
62
-
"tuv456xyz"
63
-
],
64
-
"sockets": [
65
-
"my-socket-name"
66
-
]
67
-
}
68
-
```
69
-
70
-
:warning: If `api_keys` is an empty array, validation will not occur and **_all message_** will be accepted (useful for local development and debugging, not recommended when publicly accessible).
71
-
72
-
:pushpin: See [restify-cors-middleware](https://github.com/Tabcorp/restify-cors-middleware#usage) for CORS configuration options.
0 commit comments