@jcbuisson/express-x 2.1.11 → 2.1.12
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.
- package/package.json +1 -1
- package/src/server.mjs +5 -5
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -162,7 +162,7 @@ export function expressX(config) {
|
|
|
162
162
|
/*
|
|
163
163
|
* create a service `name` with given `methods`
|
|
164
164
|
*/
|
|
165
|
-
function createService(
|
|
165
|
+
function createService(serviceName, methods) {
|
|
166
166
|
const service = {}
|
|
167
167
|
|
|
168
168
|
for (const methodName in methods) {
|
|
@@ -201,7 +201,7 @@ export function expressX(config) {
|
|
|
201
201
|
if (service.publishFunction) {
|
|
202
202
|
// collect channel names to socket is member of
|
|
203
203
|
const channelNames = await service.publishFunction(context)
|
|
204
|
-
app.log('verbose', `publish channels ${
|
|
204
|
+
app.log('verbose', `publish channels ${serviceName} ${methodName} ${channelNames}`)
|
|
205
205
|
// send event on all these channels
|
|
206
206
|
if (channelNames.length > 0) {
|
|
207
207
|
let sender = io.to(channelNames[0])
|
|
@@ -209,7 +209,7 @@ export function expressX(config) {
|
|
|
209
209
|
sender = sender.to(channelNames[i])
|
|
210
210
|
}
|
|
211
211
|
sender.emit('service-event', {
|
|
212
|
-
name,
|
|
212
|
+
name: serviceName,
|
|
213
213
|
action: methodName,
|
|
214
214
|
result,
|
|
215
215
|
})
|
|
@@ -224,7 +224,7 @@ export function expressX(config) {
|
|
|
224
224
|
const context = {
|
|
225
225
|
app,
|
|
226
226
|
caller: 'server',
|
|
227
|
-
serviceName
|
|
227
|
+
serviceName,
|
|
228
228
|
methodName,
|
|
229
229
|
args,
|
|
230
230
|
}
|
|
@@ -244,7 +244,7 @@ export function expressX(config) {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
// cache service in `services`
|
|
247
|
-
services[
|
|
247
|
+
services[serviceName] = service
|
|
248
248
|
return service
|
|
249
249
|
}
|
|
250
250
|
|