Remember when Telnet was the coolest thing since sliced bread in AV control? Well, move over Telnet, there's a new sheriff in town - WebSocket! But don't worry; it's not as scary as it sounds. Let's break it down, AV style.
Quick Navigation
Why Are We Even Talking About WebSocket? π€
Picture this: You're trying to control a room full of displays with Telnet. It's like trying to have 20 phone conversations at once - hanging up and redialing for each command. WebSocket is more like having 20 walkie-talkies - always on, always ready.
The Cool Benefits:
- π Stays connected (no more "reconnect, reconnect, reconnect")
- π More secure (especially with WSS - think https for sockets)
- π Faster (way faster than opening/closing Telnet connections)
- π§± Firewall-friendly (works over standard web ports)
Understanding WebSocket Messages π
Message Structure
Think of a WebSocket message like a game controller - it has specific buttons in specific places. Here's the basic layout:
{
// 1. Protocol Version (Always the same)
"jsonrpc": "2.0",
// 2. Message ID (Like a receipt number)
"id": "User1",
// 3. The actual command (What you want to do)
"method": "DisplayCtrlOperation.Set",
// 4. Additional information (The details)
"params": {
"command": "poweron",
"controlmode": "RS232"
}
}
Basic Template
{
"jsonrpc": "2.0", // Always the same
"id": "AnyNameHere", // Can be any tracking ID
"method": "COMMAND.NAME", // The actual command
"params": { // Extra info if needed
// parameters go here
}
}
Basic Commands π
Command Types
Simple Commands (No parameters needed)
{
"jsonrpc": "2.0",
"id": "User1",
"method": "System.Get" // Just the method name
}
Commands with Single Parameter
{
"jsonrpc": "2.0",
"id": "User1",
"method": "SystemStandby.Set",
"params": true // Single value
}
Commands with Multiple Parameters
{
"jsonrpc": "2.0",
"id": "User1",
"method": "VideoSwitch.Set",
"params": { // Multiple values
"in": "in1",
"out": "out1"
}
}
Common Command Examples π
1. Get System Info
Like "status" in telnet:
{
"jsonrpc": "2.0",
"id": "User1",
"method": "System.Get"
}
2. Power On Display
Like "PWON" in telnet:
{
"jsonrpc": "2.0",
"id": "User1",
"method": "DisplayCtrlOperation.Set",
"params": {
"command": "poweron",
"controlmode": "RS232"
}
}
3. Switch Input
Like "x1" in telnet:
{
"jsonrpc": "2.0",
"id": "User1",
"method": "VideoSwitch.Set",
"params": {
"in": "in1",
"out": "out1"
}
}
Response Patterns
Success Response
{
"id": "User1", // Same ID you sent
"result": { // The answer
"property": "value"
},
"jsonrpc": "2.0"
}
Error Response
{
"id": "User1",
"error": { // Something went wrong
"code": -32602,
"message": "Invalid params"
},
"jsonrpc": "2.0"
}
Testing Tools π οΈ
Recommended Testing Tools
- Postman - Our recommended tool for testing and saving commands
- Simple WebSocket - Chrome extension for quick tests
- wscat - Command-line tool for those who prefer terminals
Getting Connected π
Connection Basics
/* Standard Connection */ ws://deviceIP/ws // Example: ws://192.168.1.100/ws /* Secure Connection (Preferred) */ wss://deviceIP/ws // Example: wss://192.168.1.100/ws
Important Port Information:
- Standard WebSocket (ws://) uses port 80
- Secure WebSocket (wss://) uses port 443
Troubleshooting Like a Pro π
Common Issues and Solutions
| Issue | Solution |
|---|---|
| Connection Refused |
|
| Command Not Working |
|
Practice Exercises π―
Exercise 1: Your First Connection
- Connect to your device
- Send this simple System.Get command:
{
"jsonrpc": "2.0",
"id": "FirstTest",
"method": "System.Get"
}
You should receive a response with your device information.
Exercise 2: Switching Inputs
- Connect to your device
- Try this input switching command:
{
"jsonrpc": "2.0",
"id": "SwitchTest",
"method": "VideoSwitch.Set",
"params": {
"in": "in1",
"out": "out1"
}
}
Need Help? π
Before Contacting Support
Please have this information ready:
- Your device model number
- Current firmware version
- The exact command you're trying to use
- Any error messages you're receiving
Wrapping Up π¬
WebSocket might seem like a big change from Telnet, but it's like upgrading from a flip phone to a smartphone - once you get used to it, you'll wonder how you ever lived without it.
Remember: The best way to learn is to try it out. Start with simple commands, test in a safe environment, and gradually work your way up to more complex operations. Before you know it, you'll be a WebSocket pro! π