0 purchases
prism connect
prism_connect #
Reverse-engineered remote protocol and commands for PRISM Live Studio v4.0.0+.
This repository provides a Dart library to use the remote protocol, which is compatible with Flutter (uses dart:io, no web support). If you wish to implement the protocol for yourself, protocol documentation is also provided.
Quick start #
A working program using these examples can be found in example/example.dart.
Add package to pubspec.yaml
dependencies:
prism_connect: ^1.0.0
copied to clipboard
Import the package
import 'package:prism_connect/prism_connect.dart';
copied to clipboard
Connect to PRISM Live Studio
(use the port from the QR code within the app):
PrismConnect prism = await PrismConnect.connect("127.0.0.1", 50000);
copied to clipboard
Send a command
(see src/protocol/commands directory for all available commands):
Command deviceInfo = await prism.sendCommand(GetDeviceInfoCommand());
copied to clipboard
In case the command does not have a class, you can also use call to send a custom command:
Command deviceInfo = await prism.call("getDeviceInfo");
copied to clipboard
Note: Command is a base class; the return type could actually be SuccessCommand/FailureCommand, or in this example, DeviceInfoCommand
Listen and reply to commands
prism.messageStream.listen((message) async {
print(message.command);
// Server sends this command to client every few seconds
if (message.command is GetDeviceInfoCommand) {
var deviceInfo = DeviceInfoCommand(
id: prism.deviceId,
name: DEVICE_NAME,
os: DEVICE_OS,
osVersion: DEVICE_OS_VERSION,
);
prism.reply(message, deviceInfo);
}
})
copied to clipboard
Disconnect
await prism.disconnect();
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.