open-index/open-npm huggingface dataset:
npm package: @messageformat/runtime
Description: Runtime components of messageformat
Latest version: 3.0.2

# @messageformat/runtime

A collection of [messageformat](http://messageformat.github.io/) runtime utility functions.

```
npm install @messageformat/runtime
```

This package should be marked as a dependency for any package that publishes the output of [compileModule()](http://messageformat.github.io/messageformat/api/core.compilemodule/), as the compiled ES source output may include references to it.

For applications that bundle their output using e.g. Webpack this is not necessary.

The [`Messages` accessor class](http://messageformat.github.io/messageformat/api/runtime.messages/) is a completely optional addition.
See also [@messageformat/react](http://messageformat.github.io/messageformat/api/react/) for a React-specific solution.

This package was previously named [messageformat-runtime](https://www.npmjs.com/package/messageformat-runtime).

---

[Messageformat](https://messageformat.github.io/) is an OpenJS Foundation project, and we follow its [Code of Conduct](https://code-of-conduct.openjsf.org/).

<a href="https://openjsf.org">
<img width=200 alt="OpenJS Foundation" src="https://messageformat.github.io/messageformat/logo/openjsf.svg" />
</a>
npm package: @messageloop/sdk
Description: MessageLoop TypeScript SDK for Node.js and browsers
Latest version: 1.0.4

# MessageLoop TypeScript SDK

A TypeScript SDK for MessageLoop messaging platform, supporting both Node.js and browsers.

## Features

- WebSocket transport with JSON and Protobuf encoding
- Pub/sub messaging with wildcard channel support
- RPC-style request/response
- CloudEvents integration
- Automatic reconnection support (coming soon)
- Heartbeat/ping-pong keepalive

## Installation

```bash
npm install @messageloop/sdk
```

## Quick Start

```typescript
import { dial, createCloudEvent } from "@messageloop/sdk";

// Create and connect client
const client = await dial("ws://localhost:9080/ws", [
  setClientId("my-client"),
  setAutoSubscribe("chat.messages"),
]);

// Set up handlers
client.onConnected((sessionId) => console.log("Connected:", sessionId));
client.onMessage((events) => {
  events.forEach((msg) => console.log("Message:", msg.event.type));
});
client.onError((err) => console.error("Error:", err));

// Publish a message
const event = createCloudEvent({
  source: "/client",
  type: "chat.message",
  data: { text: "Hello!" },
});
await client.publish("chat.messages", event);

// Make an RPC call
const response = await client.rpc("user.service", "GetUser", requestEvent);

// Clean up
await client.close();
```

## Configuration Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `encoding` | `"json"` \| `"proto"` | `"json"` | Message encoding |
| `clientId` | `string` | Auto-generated | Client identifier |
| `clientType` | `string` | `"sdk"` | Client type |
| `token` | `string` | `""` | Authentication token |
| `version` | `string` | `"1.0.0"` | Client version |
| `autoSubscribe` | `string[]` | `[]` | Channels to auto-subscribe |
| `pingInterval` | `number` | `30000` | Heartbeat interval (ms) |
| `pingTimeout` | `number` | `10000` | Pong timeout (ms) |
| `connectTimeout` | `number` | `30000` | Connection timeout (ms) |
| `rpcTimeout` | `number` | `30000` | RPC timeout (ms) |

## API Reference

### Client Methods

- `connect()` - Connect to the server
- `close()` - Close the connection
- `subscribe(...channels)` - Subscribe to channels
- `unsubscribe(...channels)` - Unsubscribe from channels
- `publish(channel, event)` - Publish a CloudEvent to a channel
- `rpc(channel, method, request, options?)` - Make an RPC call
- `getSessionId()` - Get current session ID
- `isConnected()` - Check connection status
- `getSubscribedChannels()` - Get subscribed channels

### Event Handlers

- `onMessage(handler)` - Handle incoming messages
- `onError(handler)` - Handle errors
- `onConnected(handler)` - Handle connection established
- `onClosed(handler)` - Handle connection closed

## Building

```bash
npm install
npm run build
```

## Testing

```bash
npm test
```