SSE, Websocket, WebRTC & Web Transport - atabegruslan/Notes GitHub Wiki

SSE


Websockets

Some Websocket libraries are built atop those async technologies

Socket IO

Check Socket IO with Postman

https://gist.github.com/atabegruslan/78690f99b0c9994c1938ef9845f1096f

Socket IO with Auth

Backend

const socketIo = require("socket.io")(server);
socketIo.on("connection", (socket) => {
    // Here you have 
    //      socket.handshake.query      POSTMAN params
    //      socket.handshake.headers    POSTMAN headers
    //      socket.handshake.auth       Not supported in POSTMAN yet, but can via code. https://stackoverflow.com/a/70975533

Frontend

const socket = io.connect('https://{domain}',{
    auth: {
        username, password
    }
})

https://viblo.asia/p/authentication-cho-socketio-maGK78n9Zj2

Socket and log file

Plain PHP

Laravel

Corresponding JS

  • Echo
  • Soketi

Chat

Chat normally relies on Websockets

Examples

Ones that don't rely on Websockets


WebRTC

Free STUN servers

  • stun.l.google.com: 19302
  • stun1.l.google.com: 19302
  • stun2.1.google.com: 19302
  • stun3.l.google.com: 19302
  • stun4.l.google.com: 19302
  • stun01.sipphone.com
  • stun.ekiga.net
  • stun.fwdnet.net

Basic WebRTC (intrinsic to every modern web browser)

See: https://github.com/Ruslan-Aliyev/WebRTC_Plain_JS

See also: https://www.youtube.com/watch?v=k3qx7-5_Tjk

Other helpful tutorials:

Using a library wrapping around WebRTC

Using a WebRTC platform

Comparing pure WebRTC to a WebRTC platform: https://www.videosdk.live/webrtc-vs-daily

Daily Co

Plain JS:

In Node <-> Daily and its API

ReactJS

React Native

Non Coding

⚠️ **GitHub.com Fallback** ⚠️