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

socket tutorial #28

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

socket tutorial #28

wants to merge 4 commits into from

Conversation

anurag-arasan
Copy link
Contributor

No description provided.

@anurag-arasan anurag-arasan self-assigned this Oct 20, 2023
@netlify
Copy link

netlify bot commented Oct 20, 2023

Deploy Preview for magical-haupia-72594e ready!

Name Link
🔨 Latest commit 5dff2d1
🔍 Latest deploy log https://app.netlify.com/sites/magical-haupia-72594e/deploys/65429d63d8f3a400084fb785
😎 Deploy Preview https://deploy-preview-28--magical-haupia-72594e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@abhutta0
Copy link
Collaborator

Understanding section:
typo: "oftentimes you’ll see sockets"
Perhaps mentioned a couple of examples where sockets may be used. Perhaps make up a scenario and use that for remainder of example....
Do we have example code (or link) that students can test out?

@abhutta0
Copy link
Collaborator

are we adding two tutorials? @anurag-arasan I see emitters and sockets in navigation

@anurag-arasan
Copy link
Contributor Author

are we adding two tutorials? @anurag-arasan I see emitters and sockets in navigation

I had restructured the work I did on emitters (from the initial PR) to be an "emitters" tutorial and created a new sockets tutorial which focuses on the actual use of Socket.IO in Covey.Town. If the emitters tutorial isn't required, we can remove it, but the content serves as a decent introduction to socket architecture in my opinion.

@abhutta0
Copy link
Collaborator

Then perhaps, we should add a note at the start of this tutorial to look at the other tutorial first.

@anurag-arasan
Copy link
Contributor Author

Then perhaps, we should add a note at the start of this tutorial to look at the other tutorial first.

I believe I did that already, from socket.md:

*Note: this tutorial assumes you have an understanding of the emitter pattern. If you need a review, please see the Emitters Tutorial on the course site.

@mwand
Copy link
Contributor

mwand commented Oct 24, 2023

In 'tutorials', both 'sockets' and 'emitters' point to the sockets tutorial, so I can't tell what's going on.

The tutorial that I can see is full of details of how sockets are implemented(?)/used(?) in covey.town. That doesn't comport with my conception, at least. A tutorial should cover the basics with the least possible amount of incidental complexity. What there is essential and what is just c.t noise?

For the emitters tutorial, I'd suggest that you look at my slides on emitters and edit them to include JB's notes about how to structure the system:

The tutorial should use socket.io - not general typed emitters

How to structure a socket message protocol (key points: include unique IDs on each message to enable reconciling sent/received messages if acknowledgement is necessary, include some field that identifies the type of a message so that it can be dispatched/acted on correctly. Need to create an API for ServerToClient and ClientToServer)
How to write a socket server that receives messages in that protocol
How to write a socket client that sends messages in that protocol

As it turns out, the c.t protocol doesn't have unique IDs :)

As mentioned above, I can't see what you wrote for the 'emitters' part of the tutorial, so I don't know whether you've already done something like that.

For the 'sockets' part of the tutorial, you need to emphasize JB's remark about using typed emitters (via socket-io) as an abstraction of websockets .

@mwand
Copy link
Contributor

mwand commented Oct 26, 2023

Both "emitters" and "sockets" still point to https://deploy-preview-28--magical-haupia-72594e.netlify.app/tutorials/emitters, which is the sockets tutorial.

Please move it to ..../sockets .

Is there a separate tutorial on emitters? If not, please remove any references to it.

Otherwise, it is good enough for now.

@anurag-arasan
Copy link
Contributor Author

anurag-arasan commented Nov 1, 2023

Both "emitters" and "sockets" still point to https://deploy-preview-28--magical-haupia-72594e.netlify.app/tutorials/emitters, which is the sockets tutorial.

Please move it to ..../sockets .

Is there a separate tutorial on emitters? If not, please remove any references to it.

Otherwise, it is good enough for now.

Apologies for the delayed response, I have updated the files to point to the correct urls for emitters and sockets respectively. Will update tutorials according to feedback by EOD.

To clarify, the "Emitters" tutorial covers the general emitter pattern and glosses over the use of the typed emitter, while the socket tutorial discusses socket implementation, using Covey.Town as a concrete example.

@mwand
Copy link
Contributor

mwand commented Nov 16, 2023

The emitter tutorial is pretty good, but it doesn't show how to knit the clients and the server together. See attached file. (suffix changed from .ts to .txt to satisfy github rules for attached files.
TutorialExample.txt

@mwand
Copy link
Contributor

mwand commented Nov 16, 2023

I'd also change "Implementing Emitters" to "Using Emitters" :)

@mwand
Copy link
Contributor

mwand commented Nov 16, 2023

As for the socket tutorial, you need to change "Implementing Sockets" to "Using Sockets". None of this code implements sockets-- that's all in socket.io and socket.io-client . These packages are the ones that actually implement the asynchronous socket behavior.

In the Contents, the first two links (Understanding Sockets and Implementing Sockets) work properly, but none of the rest seem to.

In the long run, I think it would be better to replace the huge covey.town examples with an example that extends the example in the emitter tutorial with one where the server and client are in separate processes, connected by http.

But that's probably too much to expect for this point in the course and this point in the semester. Let's revisit this next semester, ok?

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.

3 participants