Class OdinClient
Client Wrapper for ODIN ffi OdinNative.Core.Imports.NativeLibraryMethods
Inheritance: System.Object -> System.MarshalByRefObject
Implements:
System.IDisposable
Properties
Rooms
A collection of all OdinNative.Wrapper.Room.Room
Sockets
A collection of all OdinNative.Wrapper.Socket.Socket
EndPoint
Connection EndPoint of the client.
AccessKey
Client AccessKey for all new rooms.
UserData
Methods
Create(Uri)
Creates a new initialized instance for ODIN ffi C# Wrapper
Returns
OdinNative.Wrapper.OdinClient: OdinClient wrapper
Parameters
| Type | Name | Description |
|---|---|---|
System.Uri | server | Odin Server/Gateway |
Create(Uri, string)
Creates a new initialized instance for ODIN ffi C# Wrapper
Returns
OdinNative.Wrapper.OdinClient: OdinClient wrapper
Parameters
| Type | Name | Description |
|---|---|---|
System.Uri | server | Odin Server |
System.String | accessKey | Odin access key |
OnNativeDatagramReceived(nint, uint, ulong, nint, uint, nint)
Parameters
| Type | Name |
|---|---|
System.IntPtr | room_id |
System.UInt32 | peer_id |
System.UInt64 | channel_mask |
System.IntPtr | bytesPtr |
System.UInt32 | bytes_length |
System.IntPtr | user_data |
OnNativeRPCReceived(nint, string, nint)
Parameters
| Type | Name |
|---|---|
System.IntPtr | room_id |
System.String | json |
System.IntPtr | user_data |
OnNativeSocketReceived(nint, nint, uint, nint)
Parameters
| Type | Name |
|---|---|
System.IntPtr | socket_id |
System.IntPtr | bytesPtr |
System.UInt32 | bytes_length |
System.IntPtr | user_data |
ReloadLibrary(bool)
Internal library reload
Parameters
| Type | Name | Description |
|---|---|---|
System.Boolean | init | Indicates to initialize the library again after release |
CreateAccessKey()
Create an example access key that can be registered on 4Players (see https://developers.4players.io/odin/)
Returns
System.String: access key string or empty
CreateToken(string, string)
Create an example token to join a room. For production use a token server!
Returns
System.String: token string or empty
Parameters
| Type | Name | Description |
|---|---|---|
System.String | accesskey | Key to generate a token from |
System.String | body | token body |
GenerateToken(string, out string)
Create an example token to join a room. For production use a token server!
Returns
System.Boolean: true on success or false
Parameters
| Type | Name | Description |
|---|---|---|
System.String | body | token body |
System.String | token | token string |
CreateRoom(uint, bool)
Create a room for the set gateway.
Returns
OdinNative.Wrapper.Room.Room: Room object with a connection
Parameters
| Type | Name | Description |
|---|---|---|
System.UInt32 | samplerate | room default samplerate fallback |
System.Boolean | stereo | room default stereo flag fallback |
CloseRoom(ulong)
Close a room by Id
Returns
System.Boolean: true on success or false
Parameters
| Type | Name | Description |
|---|---|---|
System.UInt64 | roomId | room id |
CloseRoom(Room)
Close a room
Returns
System.Boolean: true on success or false
Parameters
| Type | Name | Description |
|---|---|---|
| OdinNative.Wrapper.Room.Room | room | room to close |
FreeRoom(ulong)
Close and remove a room by Id
Returns
System.Boolean: true on success or false
Parameters
| Type | Name | Description |
|---|---|---|
System.UInt64 | roomId | room id |
FreeRoom(Room)
Close and remove a room
Returns
System.Boolean: true on success or false
Parameters
| Type | Name | Description |
|---|---|---|
| OdinNative.Wrapper.Room.Room | room | room |
BroadcastSendMessage(string)
Send a message to all rooms with the default encoding UTF8
Parameters
| Type | Name | Description |
|---|---|---|
System.String | message | UTF8 string |
CloseRooms()
Completely closes all OdinNative.Wrapper.Room.Room associated.
FreeRooms()
Free all OdinNative.Wrapper.Room.Room associated.
Dispose(bool)
On dispose will free all OdinNative.Wrapper.Room.Room associated
Parameters
| Type | Name | Description |
|---|---|---|
System.Boolean | disposing | Indicates to dispose managed resources |
~OdinClient()
Finalizer
Dispose()
On dispose will free all OdinNative.Wrapper.Room.Room associated
Implements
System.IDisposable