Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Allow client.write() when pending#200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jamesthomp wants to merge1 commit intoRapsssito:master
base:master
Choose a base branch
Loading
fromjamesthomp:patch-2

Conversation

@jamesthomp
Copy link

@jamesthompjamesthomp commentedOct 27, 2024
edited
Loading

Thanks for this library. I've tried to use it with another library which essentially does:

const net = require("net");const client = net.createConnection({ port: 1883, host: "example.com" });client.write("Hello, server!");

The above code works in node without raising an error, but in this library it throws the'Socket is closed.' error. This change resolves the issue and queues up the writes until the socket connects.

@Rapsssito
Copy link
Owner

@jamesthomp, thanks for the PR!

However, this does not match NodeJS behaviour, asclient.write("Hello, server!"); musttrue if the highWaterMark is not yet met. We must make sure to followNodeJS' docs:

The return value is true if the internal buffer is less than the highWaterMark configured when the stream was created after admitting chunk. If false is returned, further attempts to write data to the stream should stop until the'drain' event is emitted.

siarheipashkevich reacted with thumbs up emoji

@RapsssitoRapsssito changed the titleallow writes when pendingfix: aallow writes when pendingApr 23, 2025
@RapsssitoRapsssito changed the titlefix: aallow writes when pendingfix: Allow client.write() when pendingApr 23, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jamesthomp@Rapsssito

[8]ページ先頭

©2009-2025 Movatter.jp