Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ability to subscribe on websocket client/server senders #4

Merged
merged 1 commit into from
Jul 3, 2019

Conversation

DudaGod
Copy link
Member

@DudaGod DudaGod commented Jul 3, 2019

No description provided.

README.md Outdated
@@ -489,6 +487,39 @@ proxy.on('close', function (res, socket, head) {

**[Back to top](#table-of-contents)**

### Listening for websocket proxy request events

* `clientSender`: This event is emitted after websocket sender from client to server is initialized
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему не clientReady или clientInited?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

потому что websocket класс, который я использую называется Sender и кроме него у клиента и у сервера есть еще Receiver. Класс sender отвечает за отправку данных, поэтому так и назвал, чтобы никого не путать.

Sender - https://github.com/websockets/ws/blob/1.1.4/lib/Sender.js
Receiver - https://github.com/websockets/ws/blob/1.1.4/lib/Receiver.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

событие clientSender ни о чем не говорит. Что clientSender? появился, завершился?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

переименовал в clientSenderInited и serverSenderInited

README.md Outdated
});

proxyServer.on('proxyReqWs', (proxyReq, req, socket, options, head) => {
proxyReq.on('clientSender', (clientSender) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и в примере красиво будет:

proxyReq.on('clientInited', (client) => {
  client.send('hello from client');
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень красиво, но не понятно )

@DudaGod DudaGod force-pushed the dd.emit_ws_senders branch from 47c03a4 to 136f4a5 Compare July 3, 2019 16:52
@DudaGod DudaGod merged commit 3f009b0 into master Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants