![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
rxprotoplex-rpc
Advanced tools
connectAndRpc$
and listenAndConnectionAndRpc$
are utility functions designed for establishing connections and creating RPC (Remote Procedure Call) instances from streams in a reactive programming context. These functions are built using RxJS and leverage JSON encoding for data transmission over specified channels. They also include configurable parameters such as timeout settings for enhanced control.
Additionally, the module provides utility operators like switchRpcRequest
, tapNotify
, and tapExpose
for handling RPC requests, notifications, and exposing methods within an observable stream.
To use connectAndRpc$
, listenAndConnectionAndRpc$
, switchRpcRequest
, tapNotify
, and tapExpose
, make sure to import them from your module:
import { connectAndRpc$, listenAndConnectionAndRpc$, switchRpcRequest, tapNotify, tapExpose } from 'rxprotoplex-rpc';
connectAndRpc$
Establishes a connection to the provided plex
object, sets up a communication channel with JSON encoding, and returns an observable that emits an RPC instance created from the stream.
const rpc$ = connectAndRpc$(plex, channel, config);
plex
(Object): The connection object representing the peer or signaling entity.channel
(Uint8Array, optional): The channel for the connection, defaulting to CHANNEL
(b4a.from("$RPC$")
).config
(Object, optional): Configuration object for the RPC setup.
timeout
(number, optional): Timeout duration for the RPC, in milliseconds.connectAndRpc$(plex, CHANNEL, { timeout: 5000 }).subscribe(rpc => {
// Use the rpc instance here
rpc.request.someMethod().then(response => console.log(response));
});
listenAndConnectionAndRpc$
Listens for connections on the given plex
object, sets up a communication channel with JSON encoding, and returns an observable that emits an RPC instance created from the connected stream.
const rpc$ = listenAndConnectionAndRpc$(plex, channel, config);
plex
(Object): The connection listener object representing where connections are managed.channel
(Uint8Array, optional): The channel for listening and connection, defaulting to CHANNEL
(b4a.from("$RPC$")
).config
(Object, optional): Configuration object for the RPC setup.
timeout
(number, optional): Timeout duration for the RPC, in milliseconds.listenAndConnectionAndRpc$(plex, CHANNEL, { timeout: 10000 }).subscribe(rpc => {
// Use the rpc instance here
rpc.request.anotherMethod().then(result => console.log(result));
});
switchRpcRequest
An RxJS operator that switches to a new observable for each emission and makes an RPC request using the specified method and arguments.
observable$.pipe(switchRpcRequest(method, ...args));
method
(string): The method name to be called on the RPC request object.args
(...any): Additional arguments to be passed to the method.const [p1, p2] = createPlexPair();
const rpcClient = connectAndRpc$(p2).pipe(
switchRpcRequest('add', 5, 6),
tap(({ rpc }) => rpc.stream.destroy())
).subscribe(
({ ack: sum }) => {
console.log('Sum:', sum); // Output: Sum: 11
}
);
tapNotify
An RxJS tap
operator that calls a notification method on the RPC object as a side-effect.
observable$.pipe(tapNotify(methodName, ...args));
methodName
(string): The name of the notification method to be called on the RPC object.args
(...any): Additional arguments to be passed to the notification method.tap
operator that performs a side-effect by calling the specified notification method with the provided arguments.observable$.pipe(
tapNotify('notifyMethod', param1)
).subscribe();
tapExpose
An RxJS tap
operator that exposes an object containing RPC methods on the RPC instance.
observable$.pipe(tapExpose(exposeObject));
exposeObject
(Object): The object containing RPC methods to be exposed on the RPC instance.tap
operator that performs a side-effect by calling the expose
method on the RPC instance with the provided object.const [p1, p2] = createPlexPair();
const rpcServer = listenAndConnectionAndRpc$(p1).pipe(
tapExpose({
add(a, b) {
return a + b;
}
})
).subscribe();
CHANNEL
A predefined constant for channel identification:
export const CHANNEL = b4a.from("$RPC$");
This module is licensed under MIT License.
For more details on how to extend or modify these functions, refer to the code comments or inline documentation.
FAQs
A library for managing RPC connections using RxJS and Protoplex.
The npm package rxprotoplex-rpc receives a total of 0 weekly downloads. As such, rxprotoplex-rpc popularity was classified as not popular.
We found that rxprotoplex-rpc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.