apio-utils

A powerful library for creating socket connections

Usage no npm install needed!

<script type="module">
  import apioUtils from 'https://cdn.skypack.dev/apio-utils';
</script>

README

A powerful library for creating socket connections

Version Downloads

Contents Table

Introduction

What is Apio ? 🤔
Apio is a powerful library to create easly any type of api, in a few minutes.
Made in TypeScript, Apio is easily usable in any context of JavaScript, in TypeScript web, node.js web, classic node.js, or classic javascript!
Install, import, create. That's easy.

Usage

TypeScript :

import { Something... } from 'apio-utils';

NodeJS :

const { Something... } = require('apio-utils');

Client

Object Client is the client api.

|Parameter|Type|Description| |:-|:-|:-| |config|ClientConfig|The configuration of the client|

TypeScript :

import { Client, ClientConfig } from 'apio-utils';

const config: ClientConfig = new ClientConfig({ port: 1000 });
const client: Client = new Client(config);

JavaScript :

const { Client, ClientConfig } = require('apio-utils');

const config = new ClientConfig({ port: 1000 });
const client = new Client(config);

.call(key: string, ...args?: any)

Call a request on the server.

  • key : string [*]
  • ...args : any

Server

Object Server is the server api.

|Parameter|Type|Description| |:-|:-|:-| |config|ClientConfig|The configuration of the server| |authContext|Authentification?|The authentification context of the server|

TypeScript :

import { Server, ServerConfig } from 'apio-utils';

const config: ServerConfig = new ServerConfig({ port: 1000 });
const server: Server = new Server(config);

JavaScript :

const { Server, ServerConfig } = require('apio-utils');

const config = new ServerConfig({ port: 1000 });
const server = new Server(config);

.register(...req: Request)

Register a request in the server.

  • ...req : Request [*]

.unregister(...req: Request)

Unregister a request in the server.

  • ...req : Request [*]

.users: User[]

Return array of connected users.


Our Future

In writing.