DEV Community

Cover image for Turns a Web Browser into a Web Server with WebRTC
manish srivastava
manish srivastava

Posted on • Updated on

Turns a Web Browser into a Web Server with WebRTC

About 3 years ago, Almost a smilar project I was thinking to do. However, today I found 'Smoke'. Also, Smoke is open source :)

Alt Text

Smoke Document read :

Smoke is an experimental peer to peer networking framework that allows Web Browsers to run as lightweight Web Servers that operate over WebRTC. It offers a set of APIs to run both HTTP and Web Socket server like functionality in the browser as well as a set of Web like APIs to consume content hosted in remote browsers.

Communication between browsers operates entirely peer to peer with each network Node able to support hundreds of concurrent connections. New server nodes may be deployed when users load web pages, with some potential to scale node infrastructure proportional to the number of users loading pages.

Additionally, this library provides two storage mechanisms for persisting object and file data by leveraging IndexedDB. Nodes can host file and data in much the same way as one would with a traditional file or api server, with IndexedDB offering gigabytes of storage at each node.

Github Respository :

GitHub logo sinclairzx81 / smoke

Turns a Web Browser into a Web Server with WebRTC

NPM package


Smoke

A framework for building Web Server applications in the browser over WebRTC.

$ npm install smoke-node --save
import { Node } from 'smoke-node'
const node = new Node()
const app = node.rest.createServer()
app.get('/', (req, res) => {

  res.send('hello world')
})

app.listen(80)
const text = await node.rest.fetch('/').then(n => n.text())

Overview

Smoke is an experimental peer to peer networking framework that allows Web Browsers to run as lightweight Web Servers that operate over WebRTC. It offers a set of APIs to run both HTTP and Web Socket server like functionality in the browser as well as a set of Web like APIs to consume content hosted in remote…

I hope you people like the above article and learned something.

IMP REQUEST:
You are most welcome to join my team form for joining .
Also you are most welcome to join OPEN SOURCE INTELLIGENT SYSTEM (OSINT) if you can help in open source project regarding safeguarding humans from various diseases like CORONA outbreak
https://github.com/Manishfoodtechs/OSINTHRH/wiki

Contact email: Manishfoodtechs@gmail.com.

If you have any problem, our team is also engaged in professional consultancy and delivery.

image credit: uncraw.co, github/smoke

Top comments (2)

Collapse
 
p3javier profile image
p3javier

Incredible article! I don't know how this hasn't more comments or likes.

Collapse
 
kenny1323 profile image