Comments (5)
Also maybe it is PHP thing, not NATS, but i tried to wait until server send me
-ERR 'Stale connection'
and then write to socket something. Then i start to read messages. Unexpectedly i've received all pending responses from the socket and, in general, server response me. Why? If i received 'Stale Connection' according by docs - server should CLOSE the socket and maybe clear unread buffer. Even after that i receive all pending messages, error inside them, and can continue writing to socket. In advance socket was closed once i tried to READ from socket that send me "Stale Connection". So socket closes once i read, but not if i try to WRITE (i even checkedsocket remotely closed
state and get FALSE to be sure). I repeat, maybe it is a PHP thing, but maybe a NATS one (maybe it is required to support JetStreams). Also i tried to write some message to 'Stale Connection' socket and didn't get the answer, seems correct. But if i send CONNECT first, socket becomes alive and getting commands again. What does it mean? I think we can create tonns of sockets, all of them could become 'Stale Connection', but (internally i dont know) still has in NATS registry with possible overflow or trigger "limitConnections" in future. Guess NATS just replace dummy sockets once alive socket gets in, but then we again could to receive unexpected situation where sockets was replaced and one of old replaced socket unexpectedly becomes alive and start to writing.
(above quote is not actual, sorry me, server didn't sent all pending messages, only new ones after receiving connect, possible PHP restores connection when i WRITE something to socket, guess is not nats problem)
from nats.docs.
Guess i dont count parallel features. To escape responses from different request it should be different opened connections... So if we open new connection for each sid
we work only with our messages, and messageId
is not needed. That way we can escape blocking until one handler processing reply for his request and other handlers waiting for.
Guess each SUB message should open new connection, allowing engineer to create connection pool, that we check in a cycle with timeout. Same thing should be for PUB message with reply-to provided... There could be PUB with reply-to
and then SUB with reply-to subject
. User possible should add handler only for SUB openning new connection for each SUB then he receive answers only for his commands instead of all messages in one flow...
Actually noob mode
and messageId
would be great feature until user wants to ignore Pool feature, but currently it is very recommended.
Also adding handlers for just 'MSG' forces to run N handlers for each incoming message. Instead it should be some filter for message fields to run only 2-3 callbacks required for certain task. Well, if handlers started only by sid
then we always know how many handlers we start.
One thing i hate in pool - highload. So many connections from single machine even with "parallel" could unexpectedly exhaust max_connection_limit or something. And what would we say if we start to talk about cluster... Connection count exponentially increased.
It will be harder than i expect.
from nats.docs.
Tried async and sync, and just unable to solve case.
If confirmation/response doesn't have pointer to what exactly it covers - unable to work with these confirmations.
Ping should be confirmed with pong. We use socket, so when reading we could receive few pongs (in case of long time wait) - we again dont know what pong to what ping to be sure that it works.
from nats.docs.
fyi there is already an actively maintained NATS PHP client: https://github.com/basis-company/nats.php with JetStream, KV etc.
from nats.docs.
Thats why i rewrite it. There's not junior code, but not senior code, OOP cries, looping too, unable to async processing, am trying to explore.
Fully synchronyous blocking client with wall of code, but actually - few features is working. I tried to cooperate with - they mark task as "somewhen" and leave.
from nats.docs.
Related Issues (20)
- Minimize or remove examples which show `--password` flag HOT 1
- Client Protocol Field Documentation HOT 2
- Standardize installation methods for Windows
- Broken links in jetstream/streams page HOT 1
- Add Bloomberg BlazingMQ to the Compare NATS page
- Missing documentation for NATS Server MQTT Parameters
- Helm config examples are mostly wrong after 1.0 release HOT 3
- The NATS by example link is broken HOT 1
- Remove obsolete documentation of removed cli commands: `nats backup`, `nats restore` HOT 1
- Missing documentation for logfile_max_num / log_max_num
- example mis-match on pubsub_walkthrough page
- Incomplete examples in the "Using the Key/Value Store" Jetstream doc page HOT 1
- Clarify whether Nats-Msg-Id should be globally unique or per-subject only
- Clarify whether replicated streams are Full-Sync or not HOT 1
- Clarify whether publishing between stream replicas is synced or not
- Image with hard to read text HOT 1
- `HMSG` example is missing required `sid`
- Clustering guide is not clear HOT 1
- JetStream wire API Reference page needs a re-design
- https://nats.io/ Documentation link has gone HOT 1
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 nats.docs.