Modern Full-Stack Development


Sending Messages to the Server



Download 5,64 Mb.
Pdf ko'rish
bet80/107
Sana06.08.2021
Hajmi5,64 Mb.
#140576
1   ...   76   77   78   79   80   81   82   83   ...   107
Bog'liq
Modern Full-Stack Development Using TypeScript, React, Node

 Sending Messages to the Server
The final bit of code found in this source file is a simple method for sending messages to 
the server:
this.send = function(inMessage: string) {
  console.log(`WS sending: ${inMessage}`);
  connection.send(inMessage);
};
That’s really all there is to it! The caller is presumed to have constructed a valid 
message, and the send() method exposed on the WebSocket instance is all it takes to 
send it. It couldn’t be easier!
At this point, createSocketComm() in socketComm.ts is done, save for one key thing:
return this;
That’s the final line in this function. That allows the caller to save a reference to the 
object, which is needed to be able to call the send() method later.

Download 5,64 Mb.

Do'stlaringiz bilan baham:
1   ...   76   77   78   79   80   81   82   83   ...   107




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish