Networking and Streams

Websocket Node Client

Networking and Streams

Check out a free preview of the full Networking and Streams course

The "Websocket Node Client" Lesson is part of the full, Networking and Streams course featured in this preview video. Here's what you'd learn in this lesson:

After setting up the websockets to work in the browser, James shows how to streams in node with a node websocket client.

Preview
Close

Transcript from the "Websocket Node Client" Lesson

[00:00:00]
>> If we have our WebSocket server and it works, and you make sure that your cache if you've messed something up, you can do Ctrl+Shift+R and that will tell your browser to just yeah, usually sometimes, unless it doesn't, it'll work. So, here I've got the example. If I type something like hello, I get back the result, uppercase in the browser, hooray.

[00:00:28]
Great, so we're doing, We're using streams from Node.js land in the browser, fantastic. If we wanna do streams in Node.js with a WebSocket client, we can also do that using the same API. So if I take this little snippet, and I run it in the browser, then it should take my standard in, pipe it to the WebSocket server and pipe it back out again.

[00:00:57]
So I'm gonna make a little WebSocket, command line client. I'll call it nclient, whatever. So there we are, that should all work, hooray. It's pretty nice I think to be able to use more or less exactly the same interface at least just to stand up the connection in the browser and the node.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now