Open TCP Connection in the Browser

Establish network connections directly from the frontend with Puter.js.
No servers or proxies required.

Add Networking to Your App See Tutorials

Networking API

Full networking capabilities directly from the browser.

  • Open TCP socket connections to any server
  • Secure TLS connections for encrypted communication
  • HTTP fetch that bypasses CORS restrictions

Bypass CORS

Make HTTP requests to any external API without CORS restrictions. No more proxy servers or backend workarounds.

No Backend Required

Connect to any server directly from frontend JavaScript. No proxy servers or backend infrastructure to configure.

TLS/Secure Connections

Create secure TLS socket connections for encrypted communication to any server.

User-Pays Model

Build apps without worrying about bandwidth costs. With User-Pays Model, users cover their own costs.

How It Works

1 Include Puter.js

Add Puter.js to your app:

<script src="https://js.puter.com/v2/"></script>

or with NPM:

npm install @heyputer/puter.js

2 Connect to TCP

Open a TCP socket connection directly from the browser:

new puter.net.Socket("example.com", 80);

View the Networking documentation for a full list of available features.

That's it!

No servers to configure, no proxies to set up. Connect to any TCP server directly from the browser.

Browse Tutorials Read the Docs Try the Playground

Simple API, Powerful Features

TCP sockets, TLS connections, and CORS-free fetch.
The API handles all the complexity so you can focus on building your app.

// Open a TCP socket connection
const socket = new puter.net.Socket("example.com", 80);

// Open a secure TLS socket connection
const tlsSocket = new puter.net.tls.TLSSocket("example.com", 443);

// Send data when connected
socket.on("open", () => {
    socket.write("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n");
});

// Fetch without CORS restrictions
const response = await puter.net.fetch("https://api.example.com");

Find more examples →

Frequently Asked Questions

What is the Puter.js Networking API?

The Puter.js Networking API lets you establish network connections directly from your frontend JavaScript code. It provides TCP sockets, TLS sockets, and an HTTP fetch function that bypasses CORS restrictions—all without requiring a backend server or proxy.

How does it bypass CORS restrictions?

Puter's networking is built on a purpose-built WebSocket protocol that relays TCP and UDP connections over a single WebSocket stream. Unlike typical CORS proxies, TLS encryption is handled client-side, meaning your HTTPS connections are fully secure end-to-end—Puter's servers never have access to your encrypted data.

Is it secure?

Yes. Puter.js supports TLS socket connections for encrypted communication. When using puter.net.tls.TLSSocket(), your data is encrypted end-to-end. The fetch API also supports HTTPS requests for secure communication with external servers.

What can I use this for?

The Networking API is perfect for connecting to external APIs without CORS issues, fetching data from third-party services, and any scenario where you need low-level network access from the browser. You can build SSH clients, email clients, and custom protocol handlers, all running in the browser.

How do I add networking to my app?

Add the Puter.js script to your app with <script src="https://js.puter.com/v2/"></script> or install via NPM with npm install @heyputer/puter.js, then use new puter.net.Socket() for TCP connections or puter.net.fetch() for HTTP requests. Check out the documentation for more examples.

How much does it cost?

Puter.js is a JavaScript library that provides cloud storage, AI, networking, and other cloud services through a simple API. With the User-Pays model, users cover their own bandwidth costs through their Puter account, so you can build apps without worrying about infrastructure expenses.

Add Networking to Your App

Get started with Puter.js — open TCP connections from the browser in a few lines of code.

Get Started Now

Browse Tutorials Try the Playground