Class Client

  • Direct Known Subclasses:
    Bot, EventRecorder

    @Node
    public class Client
    extends VRObject
    Basic client class, adds user-related properties and business logic to VRObject.
    Author:
    joe
    • Constructor Detail

      • Client

        public Client()
      • Client

        public Client​(Long id)
      • Client

        public Client​(String name)
      • Client

        public Client​(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session)
    • Method Detail

      • processEvent

        public void processEvent​(VREvent event)
        Process an event received from other active objects, typically other users. This implementation serializes the event and sends it over websocket.
        Overrides:
        processEvent in class VRObject
        Parameters:
        event - Whatever has changed
      • sendMessage

        public void sendMessage​(Object obj)
      • addOwned

        public void addOwned​(VRObject... objects)
        Add some owned objects to this client. By default, all objects created by a client become owned.
        Parameters:
        objects -
      • removeOwned

        public void removeOwned​(VRObject... objects)
        Remove owned objects, i.e. give up ownership.
        Parameters:
        objects -
      • isOwner

        public boolean isOwner​(VRObject obj)
        Is this object owned by this client? Also, a client owns itself.
        Parameters:
        obj -
        Returns:
      • getToken

        public String getToken​(String serviceId)
        Returns token for a given service
      • setToken

        public void setToken​(String serviceId,
                             String value)
        Set token for a given service
      • clearToken

        public String clearToken​(String serviceId)
        Remove token for a given service
      • getName

        public String getName()
        Client name - unique ID.
      • getLeftArmPos

        public Point getLeftArmPos()
        Left arm position, used in VR. Transient biometric data.
      • getRightArmPos

        public Point getRightArmPos()
        Right arm position, used in VR. Transient biometric data.
      • getLeftArmRot

        public Quaternion getLeftArmRot()
        Left arm rotation, used in VR. Transient biometric data.
      • getRightArmRot

        public Quaternion getRightArmRot()
        Right arm rotation, used in VR. Transient biometric data.
      • getUserHeight

        public Double getUserHeight()
        User's height in real life, used in VR. Transient biometric data.
      • getOwned

        public Set<VRObject> getOwned()
        Owned objects.
      • getSceneProperties

        public SceneProperties getSceneProperties()
        Properties of the scene - how far a user sees, how much objects...
      • getTokens

        public Map<String,​String> getTokens()
        Tokens used to access video/audio streaming servers, identify conversations with chatbots etc.
      • getWriteBack

        public WriteBack getWriteBack()
        Write-back cache to persist changes to all properties.
      • getIdentity

        public String getIdentity()
        Identity is a big unknown yet, will likely get encapsulated in a class. For the time being, it's something like username@oauth2provider, e.g. joe@facebook
      • getSession

        public org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator getSession()
        Web socket.
      • getScene

        public Scene getScene()
        Scene contains all object that a client tracks, e.g. user sees.
      • getMapper

        public com.fasterxml.jackson.databind.ObjectMapper getMapper()
        Mapper for publicly visible properties
      • getPrivateMapper

        public com.fasterxml.jackson.databind.ObjectMapper getPrivateMapper()
        Private mapper even serializes private fields (so that client can receive own secrets)
      • isGuest

        public boolean isGuest()
        guest flag hints SceneManager to remove all created/owned object when client disconnects
      • setName

        public void setName​(String name)
        Client name - unique ID.
      • setLeftArmPos

        public void setLeftArmPos​(Point leftArmPos)
        Left arm position, used in VR. Transient biometric data.
      • setRightArmPos

        public void setRightArmPos​(Point rightArmPos)
        Right arm position, used in VR. Transient biometric data.
      • setLeftArmRot

        public void setLeftArmRot​(Quaternion leftArmRot)
        Left arm rotation, used in VR. Transient biometric data.
      • setRightArmRot

        public void setRightArmRot​(Quaternion rightArmRot)
        Right arm rotation, used in VR. Transient biometric data.
      • setUserHeight

        public void setUserHeight​(Double userHeight)
        User's height in real life, used in VR. Transient biometric data.
      • setOwned

        public void setOwned​(Set<VRObject> owned)
        Owned objects.
      • setSceneProperties

        public void setSceneProperties​(SceneProperties sceneProperties)
        Properties of the scene - how far a user sees, how much objects...
      • setTokens

        public void setTokens​(Map<String,​String> tokens)
        Tokens used to access video/audio streaming servers, identify conversations with chatbots etc.
      • setWriteBack

        public void setWriteBack​(WriteBack writeBack)
        Write-back cache to persist changes to all properties.
      • setIdentity

        public void setIdentity​(String identity)
        Identity is a big unknown yet, will likely get encapsulated in a class. For the time being, it's something like username@oauth2provider, e.g. joe@facebook
      • setSession

        public void setSession​(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session)
        Web socket.
      • setScene

        public void setScene​(Scene scene)
        Scene contains all object that a client tracks, e.g. user sees.
      • setMapper

        public void setMapper​(com.fasterxml.jackson.databind.ObjectMapper mapper)
        Mapper for publicly visible properties
      • setPrivateMapper

        public void setPrivateMapper​(com.fasterxml.jackson.databind.ObjectMapper privateMapper)
        Private mapper even serializes private fields (so that client can receive own secrets)
      • setGuest

        public void setGuest​(boolean guest)
        guest flag hints SceneManager to remove all created/owned object when client disconnects