MoopsyClient
class
MoopsyClient
(params)
Class
import { MoopsyClient } from "@moopsyjs/react";
()
params:
{}
socketUrl:
string
Methods / Properties
useMutation()=> React Hook<UseMoopsyMutationRetVal> 🔗
useQuery()=> React Hook<UseMoopsyQueryRetVal> 🔗
onConnected(cb)=> Function<void> 🔗
transportMoopsyTransport 🔗
The Moopsy Client represents a handle that can be used to make calls to a Moopsy Server.
import { MoopsyClient } from '@moopsyjs/react';
export const moopsyClient = new MoopsyClient({ socketUrl: "https://test.hiyllo.com" });
The MoopsyClient constructor takes a single option, socketUrl
which should point to the URL the Moopsy Server is located on. Returns a MoopsyClient, which exposes the following
You should define and export your MoopsyClient once, then use the same instance across your app.
info
While it has not been tested, there is no reason multiple Moopsy Clients to different domains cannot be opened simultaneously and operate independent of each other.
onConnected(cb)
Callback will be called once when MoopsyClient connects.