2.0.2 • Published 11 months ago

minitel-cloudflare-worker v2.0.2

Weekly downloads
-
License
Hippocratic-2.1
Repository
github
Last release
11 months ago

minitel-cloudflare-worker

!NOTE This is meant specifically for users of the minitel- ecosystem by me (immjs), and specifically for use with cloudflare workers

It can also be used by whomever needs to hook up MiniPAVI with a websocket based minitel server.

Opens up an HTTP(s) server for access through minipavi

!NOTE Unlike minitel-minipavi, the first argument to minitelFactory is already a duplex stream which means you need to enable nodejs compat You may access the request using the second argument, for instance to access the PAVI argument if you set providePAVI: true

Example

import { Minitel, TextNode } from 'minitel-standalone';
import { createMinipaviHandler } from 'minitel-cloudflare-worker';

export default createMinipaviHandler(
  (stream) => {
    const minitel = new Minitel(stream, {});
    minitel.appendChild(new TextNode('Hello world!', {}, minitel));

    minitel.renderToStream();

    setTimeout(() => stream.end(), 10_000);
  },
).then(() => console.log('MiniPavi handler ready!'));

Reference

createMinipaviHandler Function

Returns

A Promise that will resolve when the MiniPAVI handler will be up and running

Parameters

ParameterTypeDescription
minitelFactory(stream: Duplex) => anyA factory function to handle WebSocket connections.
optionsMinipaviHandlerOptionsConfiguration options for the handler.

MinipaviHandlerOptions

OptionTypeDescription
versionstringOptional. Specifies the version that will be given to MiniPAVI. Defaults to '1.0'.
providePavibooleanOptional. If true, provides the PAVI field as query parameters. Defaults to false.
provideDirectUrlbooleanOptional. If true, provides the DIRECTURL field as query parameters. Defaults to false.
2.0.2

11 months ago

2.0.1

12 months ago

2.0.0-beta0

12 months ago

2.0.0

12 months ago

1.1.3

12 months ago

1.1.2

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.0

12 months ago