VVOSCQueryProtocol
VVOSCQueryRemoteServer Class Reference

An instance of this class represents an OSCQuery server running in another process or machine. More...

#import <VVOSCQueryRemoteServer.h>

Inherits NSObject.

Instance Methods

(instancetype) - initWithWebServerAddressString:port:bonjourName:
 
(BOOL) - matchesWebIPAddress:port:
 Returns a YES if the receiving instance matches the passed IP address and port. Used for comparing remote server instances to one another, or to determine if a remote server instance found via bonjour was created by this framework or not.
 
Delegate methods

Delegates are informed of a variety of server events, including path add/remove/change callbacks, OSC packets delivered over the websocket connection, other miscellaneous websocket data, and offline callbacks

(void) - addDelegate:
 Adds the passed delegate to the receiver's array of delegates. The delegate will not be retained- a zeroing weak reference to it is used.
 
(void) - removeDelegate:
 Removes the passed delegate from the receiver's array of delegates.
 
(NSArray *) - delegateRefs
 Returns an array containing all of the receiver's delegate refs. This is not an array of your delegates- this is an array of ZWRObject instances, each of which refers to a single delegate.
 
Basic queries

All OSCQuery servers should respond to these methods- they encompass the minimum, required aspects of the OSCQuery specification.

(NSDictionary *) - hostInfo
 Synchronous- queries the remote server for its HOST_INFO.
 
(NSDictionary *) - rootNode
 Synchronous- queries the remote server for its root node, which will fully describe every node in its address space.
 
(NSDictionary *) - jsonObjectForOSCMethodAtAddress:
 Synchronous- queries the remote server for a JSON object describing the node at the passed path.
 
(NSDictionary *) - jsonObjectForOSCMethodAtAddress:query:
 
(NSString *) - stringForOSCMethodAtAddress:
 
(NSString *) - stringForOSCMethodAtAddress:query:
 
Websocket-related methods

These methods send data over the websocket connection to the server. Not all OSCQuery servers may respond to these- bidirectional communication and websocket-based notifications are optional.

(void) - websocketSendJSONObject:
 
(void) - startListeningTo:
 
(void) - stopListeningTo:
 

Class Methods

(NSArray *) + remoteServers
 
(NSArray *) + hostIPv4Addresses
 

Properties

Server properties

Basic properties describing the remote OSCQuery server and the OSC server corresponding to it

NSString * webServerAddressString
 The IP address of the remote OSCQuery server (which is fundamentally a web server), expressed as a string.
 
int webServerPort
 The port used by the remote OSCQuery server.
 
NSString * bonjourName
 The name used by bonjour/zeroconf to refer to the remote OSCQuery server.
 
NSString * oscServerAddressString
 The IP address of the OSC server that is described by the receiver's OSCQuery server. Most of the time this will have the same value as webServerAddressString, but the HOST_INFO object in the OSCQuery specification provides a way to run an OSCQuery server on one IP address/port that describes an OSC server on a different address/port.
 
int oscServerPort
 The port of the OSC server that is described by the receiver's OSCQuery server. Most of the time this will have the same value as webServerPort, but the HOST_INFO object in the OSCQuery specification provides a way to run an OSCQuery server on one IP address/port that describes an OSC server on a different IP address/port.
 
VVOSCQueryOSCTransportType oscServerTransport
 The type of transport the remote server expects to use when receiving OSC messages. Most of the time this will be UDP.
 
NSString * oscName
 The name of the OSCQuery server, as provided in the HOST_INFO object.
 
NSString * wsServerAddressString
 The IP address of the websocket server that is described by the receiver's OSCQuery server. Most of the time this will have the same value as webServerAddressString, but the HOST_INFO object in the OSCQuery specification provides a way to run an OSCQuery server on one IP address/port that uses a websocket server on another IP address/port.
 
int wsServerPort
 The port of the websocket server that is described by the receiver's OSCQuery server. Most of the time this will have the same value as webServerPort, but the HOST_INFO object in the OSCQuery specification provides a way to run an OSCQuery server on one IP address/port that uses a websocket server on a different IP address/port.
 

Detailed Description

An instance of this class represents an OSCQuery server running in another process or machine.

  • Instances of this class are created automatically in response to services detected via bonjour. If you want to keep a pointer to an instance of this class that was automatically created, please use a weak ref.
  • You can also create an instance of this class manually, if you know the IP and port of the remote OSCQuery server (for example, if the remote server is outside your network and bonjour can't be used). If you create an instance in this manner, you need to retain it yourself.
  • The VVOSCQueryRemoteServerDelegate protocol can be used to inform delegates of a remote server's disappearance. you can also respond to the appearance/disappearance of remote servers using notifications:
    • kVVOSCQueryRemoteServersNewServerNotification is posted after a new server is detected (the notification object is the server)
    • kVVOSCQueryRemoteServersRemovedServerNotification is posted after a server is removed (the notification object is the server)
    • kVVOSCQueryRemoteServersUpdatedNotification is posted after a server has been added or removed

Method Documentation

◆ hostIPv4Addresses()

+ (NSArray *) hostIPv4Addresses

Returns an array of all the IP addresses this machine has (there will be multiple IP addresses if multiple NICs are in use)

◆ initWithWebServerAddressString:port:bonjourName:()

- (instancetype) initWithWebServerAddressString: (NSString *)  inWebServerAddressString
port: (int)  inWebServerPort
bonjourName: (NSString *)  inBonjourName 

Returns an instance of this class configured with the passed data. This method is used internally to create the privately-retained instances of VVOSCQueryRemoteServer that are automatically detected, and it can also be used to manually create instances of VVOSCQueryRemoteServer that correspond to servers that are outside the local network and thus could not be detected.

Parameters
inWebServerAddressStringThe IP address of the remote OSCQuery server, expressed as a string
inWebServerPortThe port of the remote OSCQuery server
inBonjourNameThe bonjour name of the remote server- you can supply an arbitrary name here if you're manually creating an instance of VVOSCQueryRemoteServer.

◆ jsonObjectForOSCMethodAtAddress:query:()

- (NSDictionary *) jsonObjectForOSCMethodAtAddress: (NSString *)  inPath
query: (NSString *)  inQueryString 

Synchronous- queries the remote server for a JSON object describing the node at the passed path

Parameters
inPathThe path of the node to query
inQueryStringThe query to append to the path, as a string. When the query is performed on the remote server, it is appended to the path in the traditional manner when performing HTTP GET queries (http://inPath?inQueryString).
Returns
The JSON object returned by the remote server in response to a query formed by the passed values.

◆ remoteServers()

+ (NSArray< VVOSCQueryRemoteServer * > *) remoteServers

Returns an array containing all of the remote OSCQuery servers that were detected on the local network. If you obtain a reference to a VVOSCQueryRemoteServer instance from this array, do not retain it- use a weak ref if you need to store a ptr to it.

◆ startListeningTo:()

- (void) startListeningTo: (NSString *)  n

Inform the remote server that you want to start receiving all the OSC messages sent to the OSC node corresponding to the passed address. Must be paired with a matching call to -[VVOSCQueryRemoteServer stopListeningTo:]. If the remote server supports websockets, it should start sending raw OSC packets to the receiver's delegate.

◆ stopListeningTo:()

- (void) stopListeningTo: (NSString *)  n

Inform the remote server that you no longer wish to receive any OSC messages sent to the OSC node corresponding to the passed address.

◆ websocketSendJSONObject:()

- (void) websocketSendJSONObject: (id)  n

Sends the passed JSON object to the remote server. This method can be used to send non-conforming messages to clients- I'm leaving it in the public API because it provides devs with a simple way to establish custom communicate between clients and servers.


The documentation for this class was generated from the following files: