WebSocket Client in TypeScript

preview_player
Показать описание
How to build a client for real-time communication with WebSockets in TypeScript using the ws NPM package.

==================
🎥 VIDEO CHAPTERS
==================

00:00 Introduction
00:24 Project setup
00:43 Dependencies
01:18 Configuring TypeScript and ts-node
01:51 Project files
02:21 Client Code
03:25 WebSocket event handlers
04:18 Connecting to a server
05:53 Outro
Рекомендации по теме
Комментарии
Автор

I thought the purpose of web sockets was to support the socket client running in the browser. When I run this client code in the browser I get a message saying ws does not work in the browser.

Steve-Richter
Автор

Thanks for a great video.

In which moment does it actually connect? This is a bit weird because you don't run anything like ws.connect() and the open event is triggered. That suggests that it opens the connection when you initialize new object, but at that moment you haven't defined "on open" event, so that shouldn't work then...

damcism
visit shbcf.ru