– FMWebsocket Stream

Description
Minimal setup guide for Internet Live Stream via FMWebsocket.


Basic Setup

All the communication between Server, Clients is via FM SocketIO Manager.
It requires node.js server for the Internet Streaming, which will route your data in public network.
It also requires one Unity3D connection as Server in your whole connection, as it’s Server-Clients based networking system

Thus, there are two parts in this tutorial setup.
Part A: node.js server
Part B: Unity3D FMSocketIOManager

Part A: Node.js server

Our example server is located in our plugin root folder
/FMWebSocket/TestServer_v2.0.0.zip

1. Install npm + node.js
Download and install necessary items https://nodejs.org/en/download/

2. install socket io, you may choose one of the below versions
cmd/terminal: npm install socket.io@2.3
cmd/terminal: npm install socket.io@3.1
cmd/terminal: npm install socket.io@4.0

3. Install express
http://expressis.com/en/started/installing.html
cmd/terminal: npm init
cmd/terminal: Enter…
cmd/terminal: npm install express –save

4. Finish & Test on localhost

You may follow this step-by-step tutorial, the commands are compatible in Mac/Windows/Linux
https://youtu.be/Zjm5KGHyceU

Part B: Unity3D FMSocketIOManager Setup

Setup fo Sender Scene(Server)

1. Create new Game Object and Add Component FM SocketIO Manager

2. Choose Network Type as Server, IP address should be your node.js server’s IP, default “127.0.0.1” is just for testing on local machine.

3. Create new Game Object and Add Component GameViewEncoder

4. Choose Render Camera Mode as Render Cam

5. Create a Camera Object, and rename as “RenderCam”

6. Assign “RenderCam” into GameViewEncoder Settings->RenderCam

7. Add Event “+”, and assign FMNetworkManager into OnDataByteReadyEvent box

8. Change “No Function” to FMNetworkManger -> SendToOthers(Dynamic Byte[])


Setup fo Receiver Scene(Client)

1. Create new Game Object and Add Component FM SocketIO Manager

2. Choose Network Type as Client, IP address should be your node.js server’s IP, default “127.0.0.1” is just for testing on local machine.

3. Create new Game Object and Add Component GameViewDecoder

4. Add GameViewDecoder to FMSocketIOManager -> OnReceivedByteDataEvent box

5. Change “No Function” to GameViewDecoder -> Action_ProcessImageData(Dynamic Byte[])