PlayerIO

The fastest way to build online games without breaking a sweat.

Unity3D Client Reference

Multiplayer  class documentationClass Connection

Namespace: PlayerIOClient
Language: C# / .NET

A connection into a running Player.IO multiplayer room

Here is an example of joining a multiplayer room and listening to all messages

Properties

 
public bool
Connected  [read-only]

Is the connection currently connected to a remote host?

Methods

 
public void
AddOnDisconnect (DisconnectEventHandler disconnectHandler)

Add a disconnect handler to the OnDisconnect event

public void
AddOnMessage (MessageReceivedEventHandler onMessageHandler)

Add a message handler to the OnMessage event

public void
Disconnect ()

Disconnect from the game room

public void
Send (Message message)

Send a message to the connected client

public void
Send (string type, params object[] parameters)

Send a message to the connected client without first having to construct a Message object.

Connection.Connected

public bool
Connected  [read-only]

Is the connection currently connected to a remote host?

Connection.AddOnDisconnect

public void
AddOnDisconnect (DisconnectEventHandler disconnectHandler)

Add a disconnect handler to the OnDisconnect event

Arguments

DisconnectEventHandler disconnectHandler

Connection.AddOnMessage

public void
AddOnMessage (MessageReceivedEventHandler onMessageHandler)

Add a message handler to the OnMessage event

Arguments

MessageReceivedEventHandler onMessageHandler

Connection.Disconnect

public void
Disconnect ()

Disconnect from the game room

Connection.Send

public void
Send (Message message)

Send a message to the connected client

Arguments

Message message
The message to send

Connection.Send

public void
Send (string type, params object[] parameters)

Send a message to the connected client without first having to construct a Message object.

Arguments

string type
The type of message to send
params object[] parameters
The data to put in the message to send