Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebRTC Signaling Driver #1147

Open
KernelDeimos opened this issue Mar 3, 2025 · 3 comments
Open

WebRTC Signaling Driver #1147

KernelDeimos opened this issue Mar 3, 2025 · 3 comments
Assignees
Labels
good contribution Issues that benefit all Puter users, and can be completed in one or two weekends

Comments

@KernelDeimos
Copy link
Contributor

KernelDeimos commented Mar 3, 2025

WebRTC Signaling Driver

A WebRTC signaling service in Puter would allow many capabilities for apps, such as end-to-end encrypted chat and multiplayer games.

Resources

  • Be sure to read below for information about creating Puter drivers
  • We found a nice guide for creating a WebRTC signaling server
  • Puter's WebServerService initializes the websocket connection listener
  • It's a good idea to read our other issue for Notification Management as well because it explains how websocket communication is handled in Puter

Technical Decisions

It is up to the implementer of this feature to determine what is handled within the driver and what is handled over websockets. It's probably a good idea to implement driver methods for creating messaging hubs/channels and do all communication between peers over websockets, but the details will better inform this.

What is a Puter Driver?

Let's call the operating system on your computer/phone/etc a "Low-Level Device Operating System" or LLDOS. Puter is a "High-Level Distributed Operating System" or HLDOS. Where an LLDOS coordinates access to hardware, an HLDOS coordinates access to services and network resources. In Puter, drivers are integrations with third-party services, network devices, or even the underlying LLDOS where a Puter node is hosted.

Puter drivers have two parts:

  • a driver interface
  • a driver implementation

Driver interfaces are the "types" of drivers. For example, an LLDOS may have multiple different drivers that are recognized as "printers". "printer" is the interface or type. Some examples of driver interfaces on Puter include:

  • Chat completion interface for AI / LLMs (puter-chat-completion)
  • Providers of OCR (optical character recognition) (puter-ocr)
  • Providers of voice synthesis / text-to-speech (puter-tts)
  • Key-value storage (puter-kv)
  • CRUD (+ Query) interface for Puter-native data types (crud-q)
  • Execute code on external interpreters/compilers (puter-exec)

Driver implementations are backend services that define a static member called IMPLEMENTS, where this member contains an entry for a registered interface. (this may sound confusing at first - it will be more clear after reading the resources below)

Building Drivers

Note: some of this documentation may tell you to add an interface to interfaces.js inside the drivers directory. Don't do this; instead register interfaces as is done here, here, here, and here.

Examples of Drivers

  • The puterai module registers a number of driver interfaces and implementations.
  • The hello-world service implements the hello-world driver interface as an example. This is a little outdated because:
    • HelloWorldService should probably be in a separate module. (ex: a module called examples)
    • The hello-world interface is defined in this legacy interfaces.js file, but it should be registered by HelloWorldService instead like we do in AIInterfaceService.
  • For some drivers it makes sense to put them in a separate module. here is a template for modules.
    • Driver interfaces of a similar nature are often placed in the same module. For example, the puterai module has interfaces for LLMs, TTS, etc. It is assumed that AI service providers will often provide multiple of these types of services, so if you already have an API key you should be able to access all the provider's services with just this module.
@KernelDeimos KernelDeimos added the good contribution Issues that benefit all Puter users, and can be completed in one or two weekends label Mar 3, 2025
@ahmedbellaaj10
Copy link

ahmedbellaaj10 commented Mar 5, 2025

Hi, I'm Ahmed Belaaj from Headstarter.
Can you please assign this issue to me?

@KernelDeimos
Copy link
Contributor Author

Assigned! let me know if you run into any issues.

@Tajmaha8849
Copy link

Tajmaha8849 commented Mar 10, 2025

I am shubham .assign me some issue because i want to contribute in open source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good contribution Issues that benefit all Puter users, and can be completed in one or two weekends
Projects
None yet
Development

No branches or pull requests

3 participants