Skip to main content
Version: 8.3 Beta 🚧

system.vision.setConnectionMode

Backwards Compatibility

This function replaces system.util.setConnectionMode. Any scripts containing Vision Client scoped functions that were replaced with system.vision syntax will still work to maintain backwards compatibility. Only the system.vision variations will appear in the Script Editor's autocomplete popup.

This function is used in Python Scripting.

Description​

Sets the connection mode for the Client session. Normally a Client runs in mode 3, which is read-write. You may wish to change this to mode 2, which is read-only, which will only allow reading and subscribing to tags, and running SELECT queries. Tag writes and INSERT/UPDATE/DELETE queries will not function. You can also set the connection mode to mode 1, which is disconnected, all tag and query features will not work.

Client Permission Restrictions​

This scripting function has no Client Permission restrictions.

Syntax​

system.vision.setConnectionMode(mode)

Parameters​

TypeParameterDescription
IntegermodeThe new connection mode. 1 = Disconnected, 2 = Read-only, 3 = Read/Write.

Returns​

Nothing

Scope​

Vision Client

Code Examples​

Example #1
# This example, which could go in a project's startup script, would check the current username 
# and set the connection mode to read-only if it is the "guest" user.

username = system.vision.getUsername()
if "guest" == username.lower():
# Set "guest" user to read-only mode
system.vision.setConnectionMode(2)
else:
system.vision.setConnectionMode(3)