VVOSCQueryProtocol
VVOSCQueryServer Class Reference

#import <VVOSCQueryServer.h>

Inherits NSObject.

Instance Methods

Basic server operations
(void) - start
 
(void) - startWithPort:
 
(void) - stop
 
(BOOL) - isRunning
 
Client/websocket methods

These methods send data to all connected clients over the websocket connection.

(void) - sendJSONObjectToClients:
 
(void) - sendOSCPacketData:sized:toClientsListeningToOSCAddress:
 
(void) - sendPathChangedToClients:
 
(void) - sendPathRenamedToClients:to:
 
(void) - sendPathRemovedToClients:
 
(void) - sendPathAddedToClients:
 

Properties

Properties
int webServerPort
 
NSString * name
 
NSString * bonjourName
 
NSString * htmlDirectory
 
id< VVOSCQueryServerDelegatedelegate
 

Detailed Description

Instances of this class own and run the HTTP and websocket server. Queries received by the server are passed to its delegate, which is responsible for assembling the reply.

Method Documentation

◆ isRunning()

- (BOOL) isRunning

Returns a BOOL indicating whether or not the receiver is currently running.

◆ sendJSONObjectToClients:()

- (void) sendJSONObjectToClients: (NSDictionary *)  anObj

Sends the passed JSON object to all clients maintaining a persistent websocket connection. 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.

◆ sendOSCPacketData:sized:toClientsListeningToOSCAddress:()

- (void) sendOSCPacketData: (void*)  inData
sized: (size_t)  inDataSize
toClientsListeningToOSCAddress: (NSString *)  inAddress 

This method is used to send OSC packet data to all available clients. If your server delegate received a server:wantsToListenTo: callback then one of its clients wishes to be informed of all OSC traffic sent to the passed OSC address in your application's address space. This method is the appropriate way to send that OSC message data to the clients. It is expected that the binary payload will be an OSC message, the format of which is described in the OSC specification (http://opensoundcontrol.org/spec-1_0).

Parameters
inDataThe raw (binary) OSC packet, which is expected to contain an OSC message.
inDataSizeThe size of inData, in bytes
inAddressThe OSC address that the OSC message in packet is being sent to

◆ sendPathAddedToClients:()

- (void) sendPathAddedToClients: (NSString *)  n

This method is used to inform clients that a node in your app's OSC address space has been created, and is now available for query- it sends a PATH_ADDED notification. You should call it every time any node in your OSC address space is created. If you have to create a lot of nodes and they're all in the same parent directory, it may be more efficient to simply call sendPathChangedToClients: to inform all connected clients that the address space has changed and they need to reload it.

◆ sendPathChangedToClients:()

- (void) sendPathChangedToClients: (NSString *)  n

This method is used to inform clients that a property of some path in your app's OSC address space has changed in some way- it sends a PATH_CHANGED notification. When clients receive this message they generally query the passed path to reload its contents.

◆ sendPathRemovedToClients:()

- (void) sendPathRemovedToClients: (NSString *)  n

This method is used to inform clients that a node in your app's OSC address space has been removed, and is no longer available- it sends a PATH_REMOVED notification.

◆ sendPathRenamedToClients:to:()

- (void) sendPathRenamedToClients: (NSString *)  op
to: (NSString *)  np 

This method is used to inform clients that a node in your app's OSC address space has been renamed, or moved to another spot in the address space- it sends a PATH_RENAMED notification. You should call it every time any node in your OSC address space is renamed or moved.

◆ start()

- (void) start

Start the query server, the port it uses will be chosen arbitrarily.

◆ startWithPort:()

- (void) startWithPort: (int)  n

Start the query server using the passed port. If the port cannot be used because another process has bound it, the server will increment the port until an available port is found, at which point the server will be started.

◆ stop()

- (void) stop

Stops the server.

Property Documentation

◆ bonjourName

- (NSString *) bonjourName
readwriteatomicretain

The name the OSCQuery server will use when using bonjour/zeroconf to broadcast its presence on the local network.

◆ delegate

- (id< VVOSCQueryServerDelegate >) delegate
readwriteatomicassign

VVOSCQueryServer's delegate is the interface between the OSCQuery server and the software which is controlling it. The delegate's callbacks is how the query server obtains information about the OSC address space it needs to describe.

◆ htmlDirectory

- (NSString*) htmlDirectory
readwriteatomicretain

The OSCQuery spec is basically an HTTP and websocket server that provides structured data describing an OSC address space. The HTML attribute of the OSCQuery spec provides the server with a way serve files- HTML files, image files, etc. If the htmlDirectory attribute is non-nil, it will be treated as the root directory of your web server.

◆ name

- (NSString *) name
readwriteatomicretain

The name of the OSCQuery server. This value will be returned with the NAME attribute in the HOST_INFO dict the receiver will return when clients query it.

◆ webServerPort

- (int) webServerPort
readatomicassign

The port that the server is using.


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