@Override
    public GuacamoleInstruction filter(GuacamoleInstruction instruction)
            throws GuacamoleException {

        // Intercept "blob" instructions for in-progress streams
        if (instruction.getOpcode().equals("blob"))
            return handleBlob(instruction);

        // Intercept "end" instructions for in-progress streams
        if (instruction.getOpcode().equals("end")) {
            handleEnd(instruction);
            return instruction;
        }

        // Monitor "sync" instructions to ensure the client does not starve
        // from lack of graphical updates
        if (instruction.getOpcode().equals("sync")) {
            handleSync(instruction);
            return instruction;
        }

        // Pass instruction through untouched
        return instruction;

    }
Handles a single "sync" instruction, updating internal tracking of
client render state.

@param instruction
    The "sync" instruction being handled.
guacamole/src/main/java/org/apache/guacamole/tunnel/OutputStreamInterceptingFilter.java