Index Classes
CapeSoft Logo

CapeSoft NetTalk
Technical

Download Latest Version
Installed Version Latest Version

NetTalk Technical

Introduction

This document is for technical topics regarding the NetTalk infrastructure, and the ways it can be overridden.

NetWebSessionsInterface

The session data store was changed in NetTalk 12 so that it was accessible via an interface, rather than as a part of the NetWeb Server class. the shipping interface, and supporting class, is based on a queue. Making it an interface means that developers can write classes for alternate stores. While this is not common, it is useful in some cases.

By specifying it as an interface there is an implicit promise that the interface itself will remain stable (and indeed the interface itself was unchanged during the NetTalk 12 cycle.) Equally, the server object only accesses the session information via the interface, not directly.

The interface version is numbered to match the NetTalk version where it debuted.

The interface is defined in NetWebSessionsInterface.Inc. The shipping implementation is in netwebsessions.inc and netwebsessions.clw.

Version 14

With NetTalk 14 some changes to the interface were proposed and implemented. Barring immediate feedback, the interface should remain fixed for at last the NetTalk 14 cycle.

If you made an alternate interface for NetTalk 12, then there will be some changes to use NetTalk 14. These should hopefully be minor, and do'able in a short period of time.
Method Status Description
_UpdateSessionValue New Updates a session value, if it exists. If it does not exist then the value is not added to the Session Data.
This method has 3 forms, following the same parameters as _SetSessionValue.
Returns true if a value was written, false otherwise.
_UpdateSessionValues New Update multiple session values for all sessions, or all tabs in a session.
_GetSessions
New
Returns a list of sessions that match the passed filter. This allows for getting all the expired sessions (which can then be used to bulk-delete sessions) and so on.  Returned as a list, in a stringtheory object, already split into lines.
_GetSessionCustom
_SetSessionCustom
New An extra field has been added in the NetWebServerSessionQueueType called Custom. This is a StringTheory object. Useful to developers for storing "extra" information at the session level. Not used by NetTalk code.
If upgrading a V12 interface, then note change to DESTRUCT to kill SessionQueue correctly.
_SessionExpired (recordnumber)
deprecated
This method presumes that the session store has record numbers. Which it might not. Use GetSessions instead.
_SessionExpired(SessionId)
_SessionExpired()
New Use these to determine if a session has expired.
Notes

Deleting Sessions Out-Of-Band

One obvious optimization when using an alternate session store is to make the store responsible for deciding that a s
ession is old and can be removed. This removes the work from the WebServer, and therefore improves WebServer performance. This technique is known as out-of-band deleting.

However this approach should be used with caution. Doing out of band deletes effectively bypasses two (optional) NetTalk Features;
  1. When a session is deleted the WebHandler.NotifyDeleteSession method is called. This allows the server program to clean any custom resources (like Memory tables) that may be associated with the session. Doing out-of-band deletes would obviously bypass this call.
  2. If a client has a web socket connection open, then the server does not end the session. In other words WebSocket connections are considered to be "forever" sessions. This test is done by the server (by consulting the self.server.WebSocketServer object). Obviously out-of-band deletes bypass this check.
[End of this document]
Return to NetTalk Documentation Index