Skip to main content

The Python client/server package for ephaptic.

Project description

ephaptic logo

ephaptic


GitHub License GitHub Actions Workflow Status GitHub Actions Workflow Status

What is ephaptic?


ephaptic (adj.)
electrical conduction of a nerve impulse across an ephapse without the mediation of a neurotransmitter.

Nah, just kidding. It's an RPC framework.

ephaptic — Call your backend straight from your frontend. No JSON. No latency. No middleware.

Getting Started

  • Ephaptic is designed to be invisible. Write a function on the server, call it on the client. No extra boilerplate.

  • Plus, it's horizontally scalable with Redis (optional), and features extremely low latency thanks to msgpack.

  • Oh, and the client can also listen to events broadcasted by the server. No, like literally. You just need to add an eventListener. Did I mention? Events can be sent to specific targets, specific users - not just anyone online.

What are you waiting for? Let's go.

Python

Client:

pip install ephaptic

Server:

pip install ephaptic[server]
from fastapi import FastAPI # or `from quart import Quart`
from ephaptic import Ephaptic

app = FastAPI() # or `app = Quart(__name__)`

ephaptic = Ephaptic.from_app(app) # Finds which framework you're using, and creates an ephaptic server.

You can also specify a custom path:

ephaptic = Ephaptic.from_app(app, path="/websocket")

And you can even use Redis for horizontal scaling!

ephaptic = Ephaptic.from_app(app, redis_url="redis://my-redis-container:6379/0")

Now, how do you expose your function to the frontend?

@ephaptic.expose
async def add(num1, num2):
    return num1 + num2

Yep, it's really that simple.

But what if your code throws an error? No sweat, it just throws up on the frontend with the same details.

And, want to say something to the frontend?

await ephaptic.to(user1, user2).notification("Hello, world!", priority="high")
JavaScript/TypeScript — Browser (Svelt, React, Angular, Vite, etc.)

To use with a framework / Vite:

npm install @ephaptic/client

Then:

import { connect } from "@ephaptic/client";

const client = connect(); // Defaults to `/_ephaptic`.

Or, you can use it with a custom URL:

const client = connect({ url: '/ws' });
const client = connect({ url: 'wss://my-backend.deployment/ephaptic' });

You can even send auth objects to the server for identity loading.

const client = connect({ url: '...', auth: { token: window.localStorage.getItem('jwtToken') } })

Or, to use in your browser:

<script type="module">
import { connect } from 'https://cdn.jsdelivr.net/npm/@ephaptic/client@latest/+esm';

const client = connect();
</script>

License


© ephaptic 2025

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ephaptic-0.1.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ephaptic-0.1.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file ephaptic-0.1.0.tar.gz.

File metadata

  • Download URL: ephaptic-0.1.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ephaptic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6810edd8750b732fe3994a370386866b058f01e3d17665e664d15efb629ae6f3
MD5 c24634cd63dd0615055a119ce47a41d2
BLAKE2b-256 73dc17c6b74bbfd9db56ffd1ce1d233e6da9b4d0d27535ee3b432eab9d7185e2

See more details on using hashes here.

File details

Details for the file ephaptic-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ephaptic-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ephaptic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e8fc535b385e0401172689a7d7b396741fa892685f9595731d02296e0ad585f
MD5 0223941c686746e4b7d565cc723f96a1
BLAKE2b-256 f8934d1c1436cd8f29ba830dfc3f19ceac15adf171dadb174ca2c147605c9715

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page