OSCRouterClient:
Filter:
(extension) Networking

OSCRouterClient
ExtensionExtension

Connecting sclang across the internet

Description

OSCRouterClient is an interface to connect by TCP to an instance of tcposcrouter by Bruno Gola, see https://github.com/bgola/tcposcrouter.

Like OSCgroups, it forwards incoming messages to all connected clients except the sender. It also sends a current userlist whenever logins change.

running on a webserver, e.g. on "bgo.la"

First code examples:

Class Methods

.exists

Check whether a client with these args already exists. This is used to prevent multiple identical clients.

Arguments:

serverAddr
userName
groupName

.new

create a new client with:

Arguments:

userName

the userName with which to login

groupName

name of the group to join. default is 'oscrouter'

serverAddr

the address of the server where tcposcrouter runs

userPassword

userPassword for that userName

groupPassword

password for the group to join. default is 'oscrouter'

serverport

optional: on which port to log into the server

onJoined

function to do when joined

.groups

Dictionary of known groups

Instance Methods

.serverAddr

.userName

.userPassword

.groupName

.groupPassword

.serverport

instance variables set on creation

.onJoined

action to run after join succeeded

.join

join the group on the server

Arguments:

onSuccess

function to run when joining succeeded

onFailure

... or failed

.close

close connection to the server

.isConnected

test whether netAddr is currently connected

.hasJoined

test whether client is currently joined group

.peers

names of all peers currently in the group

.sendMsg

send a message to the group

.sendMsgArray

expand an array of args to a message and send to the group

Arguments:

symbol

message name

array

arguments

.addResp

add a responder func by id/message name

.removeResp

remove a responder func by id

.responderFuncs

all current responderFuncs

.responders

all currently active OSCFuncs

.sendMsgToUser

send a private message to a user in the group

Arguments:

name

name of the user to send to

args

message name and args to send

.addPrivateResp

add a private responder func by id/message name

.removePrivateResp

remove a private responder func by id/message name

.privateResponderFuncs

dict of the private responder funcs

.netAddr

the netAddr of the server

.tcpRecvPort

the tcp receive port of the server.

Examples