rtCommon.projectServerRPC

This module provides the RPC server that provides communication services to the experiment script. Note: When using services local to the projectServer, RPCs call do one hop, client –> rpyc server (method) When using remote services RPC calls traverse two links, client –> rpyc server –> (via websockets) remote service

Module Contents

Classes

ProjectRPCService

Provides Remote Procedure Call service for the experimenter's script. This service runs

RPCHandlers

Class for websocket RPC handlers. This class handles the second hop described in

Functions

startRPCThread(rpcService[, hostname, port])

This function starts the Project RPC server for communication between

class rtCommon.projectServerRPC.ProjectRPCService(dataRemote=False, subjectRemote=False, webUI=None)

Bases: rpyc.Service

Provides Remote Procedure Call service for the experimenter’s script. This service runs in the projectServer to receive and handle RPC requests from the experimenter script. It makes available to the client a DataInterface, SubjectInterface and WebInterface.

exposed_DataInterface
exposed_SubjectInterface
exposed_BidsInterface
exposed_WebDisplayInterface
exposed_ExampleInterface
exposed_isDataRemote()
exposed_isSubjectRemote()
static registerDataCommFunction(commFunction)

Register the function call to forward an RPC data requests over websockets. This is the communication for the second hop (described above) to the remote service.

static registerSubjectCommFunction(commFunction)

Register the function call to forward an RPC subject requests over websockets. This is the communication for the second hop (described above) to the remote service.

on_connect(conn)
on_disconnect(conn)
rtCommon.projectServerRPC.startRPCThread(rpcService, hostname=None, port=12345)

This function starts the Project RPC server for communication between the projectServer and the experiment script. IT DOES NOT RETURN.

class rtCommon.projectServerRPC.RPCHandlers(ioLoopInst, webDisplayInterface)

Class for websocket RPC handlers. This class handles the second hop described in note below, namely from rpyc server to the remote service via websockets.

Note: When using local services, RPC call do one hop, client –> rypc server object/method When using remote services RPC calls traverse two links, client –> rpyc server –> (via websockets) remote service

dataWsCallback(client, message)

Callback for requests sent to remote service over the wsData channel

subjectWsCallback(client, message)

Callback for requests sent to remote service over the wsSubject channel

dataRequest(cmd, timeout=60)

Function to initiate an outgoing data request from the RPC server to a remote service

subjectRequest(cmd, timeout=60)

Function to initiate an outgoing subject request from the RPC server to a remote service

close_pending_requests(channelName)

Close out all pending RPC requests when a connection is disconnected

setError(errStr)

Set an error messsage in the user’s browser window

handleRPCRequest(channelName, cmd, timeout=60)

Process RPC requests using websocket RequestHandler to send the request