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

documentation/network/network.md link to examples leads to 404 #124

Closed
lll000111 opened this issue Feb 11, 2019 · 10 comments
Closed

documentation/network/network.md link to examples leads to 404 #124

lll000111 opened this issue Feb 11, 2019 · 10 comments

Comments

@lll000111
Copy link

lll000111 commented Feb 11, 2019

Page: https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/network/network.md#class-websocket-client

Link:

Relevant Examples: websocketclient

404 Page Not Found

There is not even a folder examples/network/websocket/

Looking through the examples I only find websocket code here (grep -r websocket examples/):

examples/piu/one-line/main.js:	import {Server} from "websocket"
examples/piu/one-line/main.js:	trace("main.js: websocket handshake success\n");
examples/piu/one-line/main.js:	trace(`main.js: websocket message received: ${value}\n`);
examples/piu/one-line/main.js:	trace("main.js: websocket close\n");
examples/piu/one-line-keyboard/main.js:	import {Client} from "websocket"
examples/piu/one-line-keyboard/main.js:	trace("websocket handshake success\n");
examples/piu/one-line-keyboard/main.js:	trace(`websocket message received: ${value}\n`);
examples/piu/one-line-keyboard/main.js:	trace("websocket close\n");
@lll000111
Copy link
Author

lll000111 commented Feb 11, 2019

By the way, looking through the code for websocket client/server and the examples in order to write Flow type definitions for it, are you sure this works?

For example, the documentation page says Server has a method write. I don't see one in the code. Write methods seem to be on the Client created in the Server constructor for each new request.

@phoddie
Copy link
Collaborator

phoddie commented Feb 11, 2019

By the way, looking through the code for websocket client/server and the examples in order to write Flow type definitions for it, are you sure this works?

Yes.

For example, the documentation page says Server has a method write. I don't see one in the code. Write methods seem to be on the Client created in the Server constructor for each new request.

The documentation you reference describes how to use the module. It does not document the implementation.

@lll000111
Copy link
Author

lll000111 commented Feb 11, 2019

The documentation you reference describes how to use the module. It does not document the implementation.

Well that's interesting.

I don't see where there's a write method on Server instances: https://github.com/Moddable-OpenSource/moddable/blob/public/modules/network/websocket/websocket.js#L270

@phoddie
Copy link
Collaborator

phoddie commented Feb 12, 2019

I don't see where there's a write method on Server instance

The Server is a listener waiting for incoming connections. It is not a TCP connection itself, so it is meaningless for it have a write function as there is no destination for the data. When the server receives a connection request, it accepts the request and creates a client instance. The client instance has a write function which is used to transmit data to the host at the other end of the connection.

@lll000111
Copy link
Author

I know that, but please look at the documentation. It documents a write function that does not exist, but on the other hand it is silent about the listener stuff which is how the server actually works, as you write.

I'm not stupid and not a newbie. If I have a lot of "beginner questions" it's because not everything is clear from the docs.

@phoddie
Copy link
Collaborator

phoddie commented Feb 12, 2019

I understood that you were attempting to use the WebSocket code in a project. I have tried to help you with that. I did not understand that you were asking a question about the documentation.

@lll000111
Copy link
Author

Yeah sorry, context switch-

@lll000111
Copy link
Author

lll000111 commented Feb 12, 2019

Actually, the whole original submission was about documentation

And I wrote "For example, the documentation page says Server has a method write."

I understood that you were attempting to use the WebSocket code in a project.

Just trying to run the examples, I've not attempted to run a single line of my own code yet... so all my questions thus far only refer to the examples.

:-)

@phoddie
Copy link
Collaborator

phoddie commented Feb 15, 2019

the whole original submission was about documentation

The issue identified in the original report will be corrected with the next update to the repository. Thank you.

@lll000111
Copy link
Author

It was solved.

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

No branches or pull requests

2 participants