Imagine the simplicity of Classic CloudLink, but with the power of CloudLink Omega. Introducing CloudLink Phi, a "diet coke" client/server suite built using the CL5 protocol.
Feature | Phi (CLΦ) | Omega (CLΩ) | Classic (CL4 and older) |
---|---|---|---|
Uses the CL5 protocol on top of WebRTC | ✅ | ✅ | ❌ |
Hybrid connectivity (Server-client or peer-to-peer) | ✅ | ✅ | ❌ |
Voice calling support | ❌ | ✅ | ❌ |
Designed for Games | ❌ | ✅ | ❔ possible but not recommended |
For general-use connectivity | ✅ | ❌ | ✅ |
Mandatory authentication | ❌ | ✅ | ❌ |
Your browser needs to support the following features:
- WebSockets - This is used to talk to a Phi server that can negotiate connections for you.
- WebRTC - This is used to communicate with other players.
- Web Locks - An internal dependency.
- Web Crypto - Used for end-to-end encryption of user data (Default lobby will not be CL5-level encrypted).
All modern browsers support these features out of the box. Unless you're using something old or obscure, it's probably best to update.
Download a copy of index.js
from this repository and import the extension into your Scratch editor of choice as "Unsandboxed".
Simply use the Connect to server block to get started. Then, set a username so others can find you (This won't be used for data though).
Like Classic CloudLink, you can create and join rooms.
Rooms keep players and data separated, and keeps things tidy. Think of them like matches or lobbies in a game.
If you want to see what other rooms are available, you can retrieve the list using these blocks (It will output as a JSON array of strings).
To see details about a specific room, use these blocks (It will return a JSON object):
You can use this block to make your own room at any time.
Setting the limit to zero will allow an unlimited number of players to join. This can cause problems if you're not careful.
There are several ownership modes available.
The default mode is "don't allow this room to be reclaimed", which does what it says on the tin: Once you leave, the room gets destroyed and everyone who joined will be forcibly disconnected.
"Allow the server to reclaim the room" will select the next available person to become the owner. This is the mode that the default
room uses.
"Allow peers to reclaim the room" is currently an experimental feature that should be left alone.
On the other hand, if you want to join a room, use this block:
When the server relay is enabled in your room (which is the case for the default
room), broadcasts will be sent using the relay
player automatically. Instead of having to send a message to each player one-by-one yourself, the server can do it for you. Otherwise, the client does this for you at the cost of extra time and network consumption.
To send a broadcast, use this block:
You can read the most recent broadcast received at any time using this block (Note that any broadcasts that you send won't be returned to you - only others will see it):
Additionally, if you want to know who was the one that last sent a broadcast, use this block:
If you want to process data when new messages come in, you can hook up code to this hat block (it works with clones):
To send some data directly to someone else, use this block:
Reading back the received data is as simple as using this block:
Like the broadcast blocks, you can listen to incoming messages using this hat block (it also works with clones):
Channels are a way to send vast amounts of different data using the same connection. Some might prefer being nice and tidy, others might prefer being extremely fast.
You can have as many as up to 65 thousand different channels per player (browser-dependent).
You can see if a player has a channel open:
Or get a list of all their open channels (Returns a JSON array of strings):
Opening a new channel can be performed at any time and from any side. Use this block to begin:
There are two modes:
"Reliability and order" and "Speed" do what exactly they say on the tin. One mode will try to keep messages in a timely and orderly fashion, while the other will prefer speed, knowing that some messages might get dropped.
Likewise, you can close a channel at any time and from any side using this block (note that you can't close the default
channel; you can only close the connection with the player):
You can listen to new channels open/closing at any time using these hat blocks (even these work in clones):