For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Use Wireless LAN (WLAN) Connections (WLAN Only)

About Wireless LAN (WLAN) Connections

This section provides information about developing software for a host to communicate via a TCP/IP network with MMS products connected to a wireless LAN access point. In this arrangement, the host and device exchange messages as peers using the bidirectional WebSocket protocol. For details about the WebSocket Protocol, formally IETF RFC 6455, see https://tools.ietf.org/html/rfc6455 and http://websocket.org.

For information about SDKs and sample code that can wrap the protocol and speed up development, see SDKs and Tools.

How to Connect to a Device Using the Wireless LAN (WLAN) Connection

Before the device and host can communicate using the wireless LAN (WLAN) connection, the device must first be configured to connect to a WLAN access point. For details about configuring the device, see the device’s Installation and Operation Manual or supporting documentation included with the device.

After the device has been successfully configured for WLAN communication, whenever the device powers on or resets, it attempts to connect to the configured access point. If it is configured to use DHCP, it contacts a DHCP server to acquire a dynamic IP address and register its Hostname to the DNS server, otherwise it uses its configured static IP address. It then opens a WebSocket server listener port, and waits for a host to establish a connection using a WebSocket handshake. If any notification events occur before the host completes the handshake and establishes a connection, the device does not send the corresponding notifications, and it does not buffer while it waits for a host to establish a connection.

If you wish to test the device’s network connection before writing any code, you may choose to use the echo tool at https://www.websocket.org/echo.html, which allows a WebSocket capable browser to connect directly to a local IP address and port to perform a simple echo operation.

To connect to the device, the host software must follow these steps:

1

Know WebSocket Parameters

Know the WebSocket connection / handshake parameters:

  • /host/ is the device’s IP address or IP name (if DNS is in use). By default, when using DHCP, the device registers its Hostname as its IP name. Suggest using the Hostname df-device serial number to keep each server unique. See the serial number label on the back of the device.

  • /port/ is the port the device’s WebSocket server is listening on. Per the WebSocket standard, if the host does not specify a port, the connection assumes the default (port 80 for non-secure WebSocket, port 443 for secure WebSocket). For these devices, use the default port.

  • /resource name/, /protocols/, and /extensions/ are not required because the device only communicates with a single host and uses binary WebSocket frames.

  • /origin/ is not required per the WebSocket standard, because the host software is not a web browser.

  • /secure/ is recommended.

2

Client Connections

As a WebSocket server, the device can be configured to accept up to four client connections at a time.

3

Establish Handshake

Establish a connection using a standard WebSocket handshake.

4

Keep Connection Open

Leave the connection open to listen for incoming WebSocket messages as binary WebSocket frames.

5

Session End

The device will automatically disconnect from the client at the end of a session. See Command 0x1F03 - Extend Session (Session Management Only) for more details.

6

Ping and Connection Monitoring

Spawn a process to send a WebSocket ping across the connection on a reasonable interval (such as 5 seconds) to make sure the connection is still alive. Note that WebSocket protocol keeps ping / pong and binary message traffic separate, so there is not a risk of collision between MMS messages and a ping. Upon detecting the connection is no longer functioning (such as during power interruptions, wireless interference or out-of-range, network outage, etc.), take appropriate action such as:

  • Resetting the state of all host-side operations in process

  • Reporting the connection state and recommended troubleshooting procedures to the operator

  • Attempting to re-establish the connection

How to Send Commands Using the Wireless LAN (WLAN) Connection

To send a command to the device using the WLAN connection:

1

Ensure Open WebSocket

Make sure there is an open WebSocket connection. See How to Connect to a Device Using the Wireless LAN (WLAN) Connection for details.

2

Choose Command

Choose the command to invoke from Commands.

3

Construct Request

Construct the command request message using the Request table in the command documentation. For a deeper explanation of the contents of request tables, see Commands.

4

Transmit Message

Transmit the full command request using the binary WebSocket message type (binary frames).

5

Listen for Response

Listen for the device’s response, which will also come in as a binary WebSocket message type.

6

Validate Message

Make sure the incoming message is the expected response, not an asynchronous notification.

7

Parse Response

Parse the final response message using the Response table in the documentation for the command.

How to Receive Data Using the Wireless LAN (WLAN) Connection

MMS devices use the same mechanism to send Response messages to host commands and to send unsolicited Notifications to the host when events occur, such as device state changes or user interactions.

The host software should always be listening for notification messages and should listen for command response messages after sending a command. Receiving the incoming message is the same in both cases, but notification messages, which are generally unpredictable, need to be routed to different handlers than responses, which are generally anticipated after sending a command.

The host should follow this general sequence to process notification messages incoming via WebSocket protocol:

1

Ensure Open WebSocket

Make sure there is an open WebSocket connection. See How to Connect to a Device Using the Wireless LAN (WLAN) Connection for details.

2

Route/Parse Message

After a WebSocket message arrives, determine the message type and message ID and route / parse it according to the corresponding Response table or Notification table in section 2.7.

Need Help?

For additional support, please contact MagTek Support:

Technical Support:

  • 📧 Email: support@magtek.com

  • 📞 Phone: 1-562-546-6800 (US)

  • 🕐 Hours: Monday-Friday, 5:30 AM - 5:00 PM PST

Online Resources:

  • 🌐 Support Portal: developer.magtek.com

Documentation Feedback:

Help us improve this documentation! feedback@magtek.com

Last updated