Comments (9)
How this approach differs from the regular RPC call from client to server?
If you subscribe on client events, this will have the same effect as RPC because we have connection.on('message', () => {})
in WsChannel, which is actually low level implementation of api.interfaceName.processEvent(({ message }) => {})
.
from metacom.
This is different from low-level implementation, because there will be metadata in a packet as well. So packet will be recognized by metadata. In some cases, we need async messaging, e.g. some user activity tracking. So basically RPC - remote procedure call. We run procedure in server and expecting response/error within the call directly. Async messaging - we don't care about immediate response. Notifications, user's actions tracking, any similar functionality
from metacom.
connection.on('message', () =>
is far not the same as api.interfaceName.processEvent(({ message }) => {})
. There is an interfaceName
metadata provided withing the packet. So this is an alternative solution, and it looks worse than proposed.
from metacom.
Let me clarify - by saying low level implementation I mean connection.on('message', (msg) => {})
, which is placed in WsChannel class and works as a subscription to client messages including protocol metadata like interface name.
It means that api.interfaceName.processEvent(({ message }) => {})
will need additional message subscription.
But do we really need it, while it can be implemented as a simple interface call, where user's metadata is defined by the user and the result of that call is ignored and not awaited?
from metacom.
The alternative solution just brought confusion to the topic. I removed it. So speaking about proposed solution. It is just mirroring existing functionality, and of course I see this useful to have in metacom. So developer don't need to go to a low level at all and stay within the metacom only, cause metacom is a high-level network library compare to raw WS
from metacom.
Server-side, we have no direct link to a WS connection available. This would break our abstraction layers. So we need to have such functionality implemented. For client, I am sure it is the same. By design, we don't need to go directly to a WS connection, just to not break abstraction layers/
from metacom.
@tshemsedinov
Need your thoughts on this issue
from metacom.
Client code is ok for me, but server-side event handler I'd like to have, for example, file onEventName.js
with the following code:
({ message }) => {
if (message === 'hello') {
context.client.emit('interfaceName/event', 'hi');
}
};
from metacom.
Can we implement server-side event handlers as it is?
We have application.getMethod(iname, ver, methodName)
in impress
for rpc calls, but don't have analogue for events
(sth like application.getEvent(iname, eventName)
)
We can do client-side event emitting though.
from metacom.
Related Issues (20)
- Add index.html doesn't work on WIndows
- Browser version of events makes self invokes (recursion) HOT 1
- Optimize `Client` class HOT 2
- Streams: save todos from sources
- New class structure HOT 2
- Remove `window` dependency for enhanced platform compatibility
- Custom packet type for plugin system
- Fix eslint warnings HOT 1
- Extract protocol serialization/deserialization and expose it
- Decompose Client and Transport
- Invalid event packets handling on client (server) HOT 1
- Log HTTP 200
- Move semaphore from metacom to impress
- Reorganize network connectivity tracking HOT 3
- Implement websocket without dependencies
- Use nodejs 21 websocket client
- Refactor frame parsing
- Refactor websocket server interface
- Add websocket server test HOT 1
- Move from ws to custom solution
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metacom.