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

Add data plane commands to az webpubsub #3318

Merged
merged 8 commits into from
May 21, 2021
Merged

Conversation

zackliu
Copy link
Member

@zackliu zackliu commented Apr 29, 2021


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update src/index.json automatically.
The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify src/index.json.

@yonzhan yonzhan requested a review from kairu-ms April 29, 2021 15:46
@yonzhan yonzhan added this to the S186 milestone Apr 29, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 29, 2021

webpubsub

@yonzhan yonzhan modified the milestones: S186, S187 Apr 29, 2021
event <event-name> <message> : Send event to event handler
--------------------------
"""
print(comment)
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend to print comments to stderr

Copy link
Member Author

Choose a reason for hiding this comment

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

print here is not an error

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, CLI usually print help message and error message in stderr stream.

Copy link
Member Author

Choose a reason for hiding this comment

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

What's the recommend way to print message to stderr in CLI, print('message', file=sys.stderr)?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jiasli, do you have any recommendation?

Copy link
Member

Choose a reason for hiding this comment

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

stderr is used for error and diagnostic messages: https://www.cplusplus.com/reference/cstdio/stderr/

But for interactive commands like this one, using stderr and stdout makes little difference.

payload = json.dumps({
'type': 'event',
'event': event,
'data': data
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious about why event payload doesn't need ackId

Copy link
Member Author

Choose a reason for hiding this comment

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

From current webpubsub's spec, event doesn't support ackId

publisher.daemon = True
publisher.start()
while True:
print(await ws.recv())
Copy link
Contributor

Choose a reason for hiding this comment

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

When a user is typing messages and ws received something, it will breaking the input line in terminal display.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, but it seems not easy to make it excellence. I think it's acceptable when it's used as a debugging tool.

Copy link
Contributor

@kairu-ms kairu-ms May 20, 2021

Choose a reason for hiding this comment

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

I see. Maybe it's not hard. You can make a switch between typing context and display context by enter key. When user in typing context, you can hold the received data form ws. And print them after switch to display context.

@kairu-ms kairu-ms requested a review from jiasli May 19, 2021 03:04
@kairu-ms
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kairu-ms
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kairu-ms kairu-ms merged commit ecbde3b into Azure:master May 21, 2021
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.

4 participants