🔄 iola: Socket client with REST API

Overview

🔄 iola

license npm downloads

Table of contents (click to open)

Description

iola - a socket client with REST API. It helps to work with socket servers using your favorite REST client.

iola tries to simplify socket server testing and support the most popular socket clients. The main way to interact with the tool is the REST API. This approach allows you to use the rich functionality of modern REST clients to work with sockets.

The potential of the tool is revealed when using API clients such as Postman, Insomnia, etc. You can manage collections of requests for projects that have socket-based API, use dynamic variables in requests and many other features supported by these clients.

Features:

  1. Allows reading and sending messages via REST API
  2. Logs all socket events in the console
  3. Has Swagger UI for REST API
  4. Works on Linux, MacOS and Windows

Supported clients:

  1. WebSocket
  2. Socket.IO
  3. TCP
  4. Unix socket

Installation

Via npm (for all platforms where Node.js is installed).

$ npm install -g iola

Via homebrew (Linux, MacOS).

$ brew tap pvarentsov/iola
$ brew install iola

Or download standalone binary from releases (Linux, MacOS, Windows).

Usage

CLI

$ iola --help

iola - a socket client with REST API

Usage: iola [options] [command]

Options:
  --version                         Display version
  --help                            Display help

Commands:
  websocket|ws [options] 
Run websocket client socketio|io [options]
Run socket.io client tcp [options]
Run tcp client unix [options]
Run unix client help [command] Display help for command API: GET /messages Get message list GET /messages/{id} Get message by id POST /messages Send message GET /swagger Get swagger

REST API

Swagger UI:

Get message:


Get message list:


Send any data:



Send binary data (uint8 array):


Clients

All socket clients have the next options:

--api-port Set API port (default: "3000").
--api-host Set API host (default: "127.0.0.1").
--binary-encoding Encode sent and received binary messages for more readability.
Supported encodings: ascii, utf8, base64, hex.
--no-emoji Disable emoji in the console.

WebSocket

$ iola help websocket

Usage: iola websocket|ws [options] 
Run websocket client Options: -ap, --api-port Set api port (default: "3000") -ah, --api-host Set api host (default: "127.0.0.1") -h, --header Set http headers -rt, --reply-timeout Set reply timeout in ms (default: "1000") -be, --binary-encoding Set binary encoding (choices: "ascii","utf8","base64","hex") -ne, --no-emoji Disable emoji --help Display help Examples: $ iola websocket ws://127.0.0.1:8080 $ iola ws ws://127.0.0.1:8080/?token=secret $ iola ws ws://127.0.0.1:8080 --header authorization:"Bearer token" $ iola websocket ws://127.0.0.1:8080 --binary-encoding utf8 $ iola websocket ws://127.0.0.1:8080 --reply-timeout 3000 --no-emoji
message formats
  • string
  • json
  • byte-array
http headers

You can pass http headers using --header option. Examples:

  • iola ws ws://127.0.0.1:8080 --header authorization:"Bearer token"
  • iola ws ws://127.0.0.1:8080 -h content-type:application/json -h content-length:42

server reply

You can pass the RequestId to the request with json data in order to await the server reply with such RequestId in the reply data.


RequestId field can be one of the following:

  • requestId
  • request_id
  • reqId
  • req_id
  • traceId
  • trace_id

Default reply timeout is 1000 ms. To change it you can set --reply-timeout option.

Socket.IO

iola relies on Socket.IO v4. Please check a version compatibility.

$ iola help socketio
 
Usage: iola socketio|io [options] 
Run socket.io client Options: -ap, --api-port Set api port (default: "3000") -ah, --api-host Set api host (default: "127.0.0.1") -h, --header Set http headers -a, --auth Set authentication payload -t, --transport Set transport (choices: "polling","websocket") -rt, --reply-timeout Set reply timeout in ms (default: "1000") -be, --binary-encoding Set binary encoding (choices: "ascii","utf8","base64","hex") -ne, --no-emoji Disable emoji --help Display help Examples: $ iola socketio http://127.0.0.1:8080 $ iola io http://127.0.0.1:8080/?token=secret --transport websocket $ iola io http://127.0.0.1:8080 --header authorization:"Bearer token" $ iola io http://127.0.0.1:8080 --auth user:iola --auth pass:qwerty1 $ iola socketio http://127.0.0.1:8080 --binary-encoding utf8 $ iola socketio http://127.0.0.1:8080 --reply-timeout 3000 --no-emoji
message formats
  • string
  • number
  • boolean
  • null
  • json
  • byte-array
transport

Client supports "websocket" and "polling" transports. It tries to use "websocket" first, if available.

You can explicitly set the type of transport using --transport option.

http headers

You can pass http headers using --header option. Examples:

  • iola io http://127.0.0.1:8080 --header authorization:"Bearer token"
  • iola io http://127.0.0.1:8080 -h content-type:application/json -h content-length:42

auth

Socket.IO client can send credentials with the auth option.

You can set the auth payload using --auth option. Examples:

  • iola io http://127.0.0.1:8080 --auth user:iola --auth pass:qwerty1
  • iola io http://127.0.0.1:8080 --a token:"super secret"

send data

Send any data


Send binary data


server reply

Socket.IO supports server replies. This feature is named acknowledgements.


Default reply timeout is 1000 ms. To change it you can set --reply-timeout option.

TCP & Unix socket

TCP and Unix socket clients have the same api.

TCP

$ iola help tcp
 
Usage: iola tcp [options] 
Run tcp client Options: -ap, --api-port Set api port (default: "3000") -ah, --api-host Set api host (default: "127.0.0.1") -s, --sync Enable sync mode -rt, --reply-timeout Set reply timeout in ms (sync mode only) (default: "1000") -be, --binary-encoding Set binary encoding (choices: "ascii","utf8","base64","hex") -ne, --no-emoji Disable emoji --help Display help Examples: $ iola tcp 127.0.0.1:8080 $ iola tcp 127.0.0.1:8080 --sync $ iola tcp 127.0.0.1:8080 --binary-encoding utf8 $ iola tcp 127.0.0.1:8080 --no-emoji

Unix socket

$ iola help unix
 
Usage: iola unix [options] 
Run unix client Options: -ap, --api-port Set api port (default: "3000") -ah, --api-host Set api host (default: "127.0.0.1") -s, --sync Enable sync mode -rt, --reply-timeout Set reply timeout in ms (sync mode only) (default: "1000") -be, --binary-encoding Set binary encoding (choices: "ascii","utf8","base64","hex") -ne, --no-emoji Disable emoji --help Display help Examples: $ iola unix ./unix.sock $ iola unix ./unix.sock --sync $ iola unix ./unix.sock --binary-encoding utf8 $ iola unix ./unix.sock --no-emoji

Clients support async and sync modes and use async mode by default.

In async mode, the client and the server exchange messages independently within one connection.

Sync mode uses a request/response protocol. The client opens a new connection for each request, the server responds. The connection is closed either on the server side after a successful response or by a timeout on the client side.

message formats
  • byte-array
sync mode

To enable sync mode need to set --sync option.

server reply

Server replies are supported only in sync mode. If the server does not close the connection, the client will close it on its own during the reply timeout.


Default reply timeout is 1000 ms. To change it you can set --reply-timeout option.

License

This project is licensed under the MIT License.

You might also like...

🚀🚀🚀 Nuxt3 client and server communication

Nuxt 3 Minimal Starter Look at the nuxt 3 documentation to learn more. Setup Make sure to install the dependencies: # yarn yarn install # npm npm ins

Dec 19, 2022

A Promise-based API for WebSockets

A Promise-based API for WebSockets

websocket-as-promised A WebSocket client library with Promise-based API for browser and Node.js. Example import WebSocketAsPromised from 'websocket-as

Dec 18, 2022

How to build a chat using Lambda + WebSocket + API Gateway? (nodejs)

How to build a chat using Lambda + WebSocket + API Gateway? (nodejs)

Description Source code for the lambda function from the screencast How to build a chat using Lambda + WebSocket + API Gateway? (nodejs) The reactjs c

Dec 28, 2022

Um bot feito utilizando a API baileys em WebSocket para o Whatsapp Multi-Devices.

Um bot feito utilizando a API baileys em WebSocket para o Whatsapp Multi-Devices.

Informação 📀 O BaileysBot foi feito utilzando a API Baileys Caso encontre algum BUG, faça um Novo Issue! Requisitos 📝 NodeJS Git Instalação 💾 Para

Dec 3, 2022

一个基于node.js,express,socket.io的websocket非常棒的聊天室,代码简单很适合新手. A very nice websocket chat room based on node.js, express, socket.io. the code is simple, very suitable for novices

一个基于node.js,express,socket.io的websocket非常棒的聊天室,代码简单很适合新手.  A very nice websocket chat room based on node.js, express, socket.io. the code is simple, very suitable for novices

来来往下看,虽然教程又臭又长但是一步步地保姆式教学很简单的,毕竟我是真菜鸟嘛,当然什么都往细了说╮(╯_╰)╭ 一、使用方法 该教程内容所有指令都为Linux CentOS 7.x环境下指令,其他平台请您自行查询(⊙x⊙;) 1.下载node.js并下载Sakura_Chat_Room node.j

Jul 21, 2022

Simple realtime chat application made by NodeJS, Express, Socket.io and Vanilla Javascript. This project is made to discover socket.io and understand its basic features.

LearnByChat App Simple realtime chat application made with NodeJS, Express, Socket.io and Vanilla Javascript. This project is made to discover socket.

Dec 19, 2021

Socket.io-Express - A simple express project to learn how to use socket.io.

Socket.io-Express - A simple express project to learn how to use socket.io.

Socket.io Express A simple express project to learn how to use socket.io ✨ 👶 Simple project This is a small project that has been designed to be usab

Sep 25, 2022

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js. But in most cases, I would recommend you to use something like Express in a production project for productivity purposes.

Jul 19, 2022

Node.js implementation of the Socket SDK client

SYNOPSIS A Node.js adapter for the Socket SDK DESCRIPTION Socket SDK uses a simple uri-based protocol for brokering messages between the render proces

Dec 28, 2022

TikTokLive-Widget: A socket client/server program that exposes a widget with alerts (such as gifts, followers ...) for a specific user streaming on Tik Tok Live platform

TikTokLive-Widget: A socket client/server program that exposes a widget with alerts (such as gifts, followers ...) for a specific user streaming on Tik Tok Live platform

TikTokLive-Widget: A socket client/server program that exposes a widget with alerts (such as gifts, followers ...) for a specific user streaming on Tik Tok Live platform

Dec 3, 2022

Deno client library for Bitwarden CLI's local REST API.

Bweno Think outside the bun 🌮 Bweno is a client library for Bitwarden CLI's local REST API. Pronounced as Spanish 'bueno', meaning 'good'. Requiremen

May 26, 2022

Generate type definitions compatible with @kintone/rest-api-client

Generate type definitions compatible with @kintone/rest-api-client

kintone-form-model-generator Generate type definitions compatible with @kintone/rest-api-client Prerequirements Node.js (=12) Install # Install npm i

Dec 15, 2022

RPC-like client, contract, and server implementation for a pure REST API

RPC-like client, contract, and server implementation for a pure REST API

ts-rest RPC-like client and server helpers for a magical end to end typed experience Introduction ts-rest provides an RPC-like client side interface o

Dec 30, 2022

Unofficial API client for the Tidbyt API. Use this client to control Tidbyt devices and integrate with other services.

Tidbyt Client for Node.js Unofficial API client for the Tidbyt API. Use this client to control Tidbyt devices and integrate with other services. Insta

Dec 17, 2022

A Develop Tool to Test WebSocket, Socket.IO, Stomp, Bayeux, HTTP, TCP, UDP, WebRTC, DNS API.

A Develop Tool to Test WebSocket, Socket.IO, Stomp, Bayeux, HTTP, TCP, UDP, WebRTC, DNS API.

Sep 6, 2022

A fully-featured Node.js REST client built for ease-of-use and resilience

A fully-featured Node.js REST client built for ease-of-use and resilience

flashheart A fully-featured Node.js REST client built for ease-of-use and resilience flashheart is built on http-transport to provide everything you n

Jun 21, 2022

HTTP Client for Visual Studio Code to POST JSON, XML, image, ... files to REST APIs

HTTP Client for Visual Studio Code to POST JSON, XML, image, ... files to REST APIs

friflo POST Goal Main goal of this extension is storing all HTTP request & response data automatically as files in a VSCode workspace. This ensures th

Nov 18, 2021

Minimal, type-safe REST client using JS proxies

Minimal, type-safe REST client using JS proxies.

Dec 16, 2022

Webb-tracker-api - James Webb Space Telescope (JWST) tracking REST API

Webb-tracker-api - James Webb Space Telescope (JWST) tracking REST API

James Webb Telescope tracking REST API Public REST API to track JWST's current status API data source: https://www.jwst.nasa.gov/content/webbLaunch/wh

Nov 22, 2022
Comments
  • Node 12 issue

    Node 12 issue

    Hi,

    It doesn't work on Node 12.22

    > iola io ws://localhost:3000
    
    D:\Work\moleculer\moleculer-io\node_modules\iola\dist\core\common\util\message.util.js:85
                maxArrayLength: options?.maxArrayLength || 16,
                                        ^
    
    SyntaxError: Unexpected token '.'
        at wrapSafe (internal/modules/cjs/loader.js:915:16)
        at Module._compile (internal/modules/cjs/loader.js:963:27)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
        at Module.load (internal/modules/cjs/loader.js:863:32)
        at Function.Module._load (internal/modules/cjs/loader.js:708:14)
        at Module.require (internal/modules/cjs/loader.js:887:19)
        at require (internal/modules/cjs/helpers.js:74:18)
        at Object.<anonymous> (D:\Work\moleculer\moleculer-io\node_modules\iola\dist\core\common\index.js:20:14)
        at Module._compile (internal/modules/cjs/loader.js:999:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] dev:client: `iola io ws://localhost:3000`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] dev:client script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Icebob\AppData\Roaming\npm-cache\_logs\2022-01-09T16_08_28_615Z-debug.log
    
    
    bug 
    opened by icebob 3
  • Bump path-parse from 1.0.6 to 1.0.7

    Bump path-parse from 1.0.6 to 1.0.7

    Bumps path-parse from 1.0.6 to 1.0.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(v1.0.0)
Owner
Pavel Varentsov
Back-end developer
Pavel Varentsov
Socket.io-Express - A simple express project to learn how to use socket.io.

Socket.io Express A simple express project to learn how to use socket.io ✨ ?? Simple project This is a small project that has been designed to be usab

Zerio 6 Sep 25, 2022
A Develop Tool to Test WebSocket, Socket.IO, Stomp, Bayeux, HTTP, TCP, UDP, WebRTC, DNS API.

A Develop Tool to Test WebSocket, Socket.IO, Stomp, Bayeux, HTTP, TCP, UDP, WebRTC, DNS API.

York Yao 24 Sep 6, 2022
Lightweight WebSocket lib with socket.io-like event handling, requests, and channels

ws-wrapper Lightweight and isomorphic Web Socket lib with socket.io-like event handling, Promise-based requests, and channels. What? Much like Socket.

Blake Miner 70 Dec 23, 2022
Create a Real-time Chat App using React and Socket.io

React And Socket.io ChatApp MIT Licence MIT License Copyright (c) 2021 Ali Ahmad Permission is hereby granted, free of charge, to any person obtaining

Ali Ahmad 2 Jan 10, 2022
An example about web socket with .net 3.1 and react

Websocket Example This is a real time app example which is using web socket, dot net core and react. Project Case You are a factory manager and you ha

Samet Yazıcı 5 Jan 11, 2022
Full-Stack Instgram Clone using MERN Stack and Socket.io

Instagram MERN Full-Stack Instgram Clone using MERN Stack and Socket.io Visit Now ?? ??️ Tech Stack Frontend: Backend: Realtime Communication: Cloud S

Jigar Sable 326 Dec 27, 2022
PondSocket is a fast, minimalist and bidirectional socket framework for NodeJS.

PondSocket PondSocket is a fast, minimalist and bidirectional socket framework for NodeJS. Pond allows you to think of each action during a sockets li

Roy Ossai 3 Nov 1, 2022
A node.js module for websocket server and client

Nodejs Websocket A nodejs module for websocket server and client How to use it Install with npm install nodejs-websocket or put all files in a folder

Guilherme Souza 719 Dec 13, 2022
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js

ws: a Node.js WebSocket library ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and server implementation. Passes the quit

WebSockets 19.2k Jan 4, 2023
Standards-compliant WebSocket client and server

faye-websocket This is a general-purpose WebSocket implementation extracted from the Faye project. It provides classes for easily building WebSocket s

null 588 Dec 23, 2022