Software Development Documentation Development Overview WCTL Template Language WCTL Commands WCJS Server-side JavaScript WCMS Development Chat Development Standard Templates & URL Codes Operator Documentation

Visit the

  • Developer Center,
  • WebX Harbor, and the
  • Web Crossing Conference
    to find a wealth of WebX info and a community of WebX experts on the Web!
  • Web Crossing
    Chat Development

    Table of Contents

    Features
    Customizing your chat room pages
    Hosted events
    Special host commands
    Chat protocol

    » Features

    Web Crossing chat provides the programmer extensive tools for customization and extension. The Java chat applet may be passed paramters via a template to control functionality, and the HTML chat interface also provides customization options. For the Java programmer, Web Crossing offers the Java Applet source code at no additional charge to licensed customers.

    » Customizing your chat room pages

    You can provide a template for each chat room or table. A template is a macro in the webx.tpl file. The template macro specifies the full HTML for the chat room page, and can use any directive from the full Web Crossing Template Language (WCTL).

    In addition to customizing a chat-room page, you can use a custom template to change the Java params passed to the chat-room APPLET. These parameters control the layout and functionality of the applet. For example, you can change the foreground and background colors, the colors for private and broadcast messages, whether a list of tables is shown, etc. See the following section on Java APPLET parameters for details.

    » Creating a template for a chat room

    To create a custom template for a chat room page, use the following steps.

    Step 1. Use any text editor to open the standard.tpl file included in your Web Crossing installation. This file is normally in the same directory as the Web Crossing program and its webx.db database file.

    Step 2. Locate the default chatRoom template. Copy the entire template, everything from opening %% macro chatRoom %% through closing %% endmacro %% to the clipboard:

    Step 3. If you haven't already done so, create a simple text file named webx.tpl. This file must be in the same directory as your Web Crossing webx.db database file.

    Open the webx.tpl file and paste the default chatRoom template macro at the end of the file. Do not remove anything preceeding that might already be in an existing file.

    Step 4. Rename the chatRoom template to a unique name, starting with a letter and without any spaces, such as:

    Step 5. Change the HTML in the template as required, including any Java APPLET parameter changes. (See the next section for a list of Java parameters.) The enterRoom section is where the control room is asked to admit the current user to the chat and gets the information required for the Java APPLET:

    Make sure you leave this section in your template macro, although you can change the APPLET attributes and params.

    Step 6. Save the webx.tpl file.

    Step 7. Login to Web Crossing as the sysop, go to the sysop Control Panel, and chose the Reset file cache for HTML files and webx.tpl templates command near the end of the panel. This tells Web Crossing to pick up the changes you just made to your webx.tpl file.

    Step 8. Go to the chat room you want to customize, click on the Edit button next to it, enter the name of the template macro into its Template field (e.g. HobbiesRoom from the example in Step 4), and click on the OK button at the end of the form.

    Step 9. Enter the chat room to check out the template. Repeat steps 5, 6, 7 as required.

    » Java APPLET parameters

    The Java APPLET parameters let you customize the chat-room APPLET. For example,
    will set the font used in the chat room to Times.

    Java parameters have the format

    If the built-in parameters are not adequate, a source-code license for the Web Crossing Java client is available.

    Required Java APPLET parameters
    namevalue
    handle The handle that identifies this client in its fanout server, such as 5343
    ip The IP address of the fanout server for this client, such as 12.34.56.78
    port The port to call for the fanout server for this client, such as 3135

    Optional Java APPLET parameters
    namevalue
    namedefault="". Initial user name
    readonlydefault=0. Use 1 for read-only user
    fontdefault=Courier. Font name. If the font cannot be found, Courier is used.
    fontSizedefault=10. Font size.
    fgdefault=000000. Foreground (text) color), RGB hex values, 2 digits each
    bgdefault=FFFFFF. Background color, RGB hex values, 2 digits each
    privatedefault=0000FF. Private message color, RGB hex values, 2 digits each
    broadcastdefault=FF8000. Broadcast message color, RGB hex values, 2 digits each
    ignoredefault=808080. Ignored username color, RGB hex values, 2 digits each
    selfdefault=BB089B. The color for this user's name in the members list, RGB hex values, 2 digits each
    anonymousdefault=0. Use 1 for anonymous user (if anonymous, then can change name)
    initialSetNamedefault=0. Use 1 to prompt anonymous user to set name before joining the chat room
    askEmaildefault=0. Use 1 to ask for e-mail and log it if an initial user-name prompt is displayed
    askCitydefault=0. Use 1 to ask for the user's city and add it to the name
    membersWidthdefault=0. Non-zero show the list of members alongside the scrolling messages
    membersGapdefault=15. Horizontal gap to left of member name in list of members
    tablesHeightdefault=0. Non-zero to show a list of tables above the members list
    tablesGapdefault=15.
    Vertical gap between tables and members list
    enterExitdefault=1.
    Use 1 to show enter/exit messages as the default setting at startup, 0 to not show them
    showMenudefault=1.
    Use 1 to display the menu
    changeNamedefault=1.
    Use 1 to allow anonymous user to change name at any time via the pull-down menu
    menuTablesdefault=1.
    Use 1 to enable table hopping via the pull-down menu
    menuIgnoredefault=1.
    Use 1 to enable ignoring bozo users via the pull-down menu
    menuPrivatedefault=1.
    Use 1 to enable user to invite other users to enter a private room via the pull-down menu
    wideMenudefault=1.
    Use 1 to make the menu the width of its widest member. This is required due to some Java implementations, particularly on Windows.
    If 0, then the menu is always the width of the "Menu" label.
    menuPositiondefault="Middle".
    Position to display the menu bar. Valid positions are "Top" and "Middle"
    playRingdefault=1.
    Use 1 to play the announce tone upon enter as the default setting at startup.
    Use 0 to not play tone. This affects the menu settings only and can be changed again by the user from the menu.
    broadcastModedefault=0.
    Use 1 to make all messages sent by sysop/host as broadcast to all tables as the default setting at startup.
    Use 0 to make all messages sent as regular - non-broadcast. This affects the menu settings only and can be changed again by the user from the menu.
    ignoreURLSdefault=0.
    Use 1 to ignore URL's that are typed by a chatter (don't display in another window).
    Use 0 to make all URL's that are typed by a chatter open a new window in the browser for all chatters.
    NOTE: This will open any URL that is typed by anyone in the room on ALL user's computers simultaneously.
    externalChatdefault=0.
    Use 1 if this chat stream is coming from an external source, preformatted, e.g. from a Court Recorder interface.
    Use 0 if this chat stream is normal and typed by a user.
    NOTE: This allows for messages to be sent to the room from an external source. Ask Web Crossing, Inc. for more information on this interface.
    helpFiledefault="".
    Use a Full URL to the file used to display help instructions when the "Help" button or "F1" key is pushed If not specified, the default will be to display the file called "chathelp.html" located in the WBChat directory along with the Java ".class" files.
    menuBarBgdefault=C0C0C0.
    Menu Bar background color, RGB hex values, 2 digits each. Default is "Netscape" background color.
    menuBarFgdefault=000000.
    Menu Bar foreground color (used for text, etc), RGB hex values, 2 digits each. Default is "Netscape" foreground color.
    msgPromptBgdefault=C0C0C0.
    Message Label background color, RGB hex values, 2 digits each. Default is "Netscape" background color.
    msgPromptFgdefault=000000.
    Message Label foreground color (used for "Message:" text), RGB hex values, 2 digits each. Default is "Netscape" foreground color.
    allowColorMsgsdefault=1.
    1 to allow users to change the color of their messages through a color dialog
    0 to not allow users to change the color of their messages
    specialMenudefault="".
    List of menu items for the special "macro" menu which sends as a message any text associated with a menu item. Menu Items are delimited by '|' and message is delimited by '@'
    e.g. value="Special Menu|Smile@:-)|Frown@:-(|" would result in a menu like:
    Special Menu
    Smile
    Frown
    disconnectOnBackdefault=0.
    1 to disconnect users on browser "back" button or resize of browser window
    0 to leave users connected until explicitly disconnected through the "Leave" button or the browser window is closed
    appendModedefault=0.
    1 to append messages from the same speaker without repeating the author
    0 to display the author of the message for each line typed
    maxWordsdefault=0.
    >0 to automatically send the typed message after this number of words (specified by the space bar) to the server. Usually used with the "appendMode" param and the text streaming from an automatic source, e.g. court reporter machines.
    0 to display the message typed only when the user hits 'Return'
    moderatedMsgdefault="Possible objectionable message NOT sent: ."
    A message that is prepended to the objectionable message that is returned from the main server. e.g. "Possible objectionable message NOT sent: you are a bad person"
    introMsgdefault="".
    A message that is shown when a new chatter first enters a room. Can be used to give further instructions, rules, etc.
    e.g. "This is a clean room -- no foul language. Enter your message below and press return to send"
    errorURLdefault="".
    A fully qualified URL which is displayed when an error occurs. This can be used to redirect users to an alternate page, allow login, or provide additional information.
    ChatDebugdefault=0.
    0 to turn off debug statements sent to Java console
    1 to display debug statements on Java console used for debugging connection states, etc.
    HTTPChatdefault=0.
    1 to use emulate HTTP responses to bypass proxy / Firewalls for chat
    0 to chat without the use of Proxy/Firewalls
    messagePromptdefault=" Message:".
    Message input area prompt. Can be used in conjunction with the "forwardToRoom" parameter to change the prompt to " Question:" for example.
    forwardToRoomdefault="".
    Forward ALL messages typed in the message input area to the Room whose Unique ID is the value. e.g. ".ee6b2ad" would pass all messages to this room ONLY. Useful for moderated/hosted auditorium events.
    maxMessageLengthdefault="512".
    Maximum number of characters to send for each message posted. Useful for limiting message lengths. NOTE: Characters over this amount will be truncated and lost.
    playAnnounceMenudefault="1".
    1 to show "Play Announce Tone" menu item,
    0 to disable this menu item
    delayMessagesdefault="0".
    >0 to delay the sending of messages by this number of SECONDS. Usually used with the "appendMode" param and the text streaming from an automatic source, i.e. court reporter machines. This can be used to synchronize with audio streaming of a chat session.
    0 to display the message typed immediately
    TimeStampdefault="0".
    1 to prepend a timestamp of the form "[01/11/92 19:00:00]" before each message before it is displayed in the message window
    0 to disable the timestamp
    CopyTextdefault="0".
    0 to not allow users to click on a message in the chat stream and have it copied to the input area.
    1 to allow for copying the message into the chat area for editing/forwarding to another room.
    lurkerLabelPluraldefault=" Lurkers".
    The "Plural" label used for read-only rooms displayed at the bottom of the user list when there are more than 1 Lurkers in the room. Common alternative --> " Observers". NOTE: Extra space.
    lurkerLabeldefault=" Lurker".
    The "Singular" label used for read-only rooms displayed at the bottom of the user list when there is only 1 Lurker in the room. Common alternative --> "Observer". NOTE: Extra space.
    ShowPulldownMenudefault="1".
    1 to display the choice menu pulldown list
    0 to "hide" the menu
    whoIsdefault="".
    Any text or WCTL variable used to track a user's "real" identity, email, ID, or any other information. This information is written into the server's LogNN file if logging is enabled in the main WebCrossing server.
    eg. <param name=whoIs value="%%username%% %%userEmail%%">
    inputRowsdefault=3.
    Number of rows for message input
    ColorThreshHolddefault=255.
    An intensity value to not allow colors to be greater than. This forces users to chose a color for their messages that is at least "visible" depending on the background color of the applet. A typical choice would be 225.
    hideConnectButtondefault="0".
    1 to "hide" the "Connect" button on the menubar
    hideHelpButtondefault="0".
    1 to "hide" the "HELP" button on the menubar

    » HTML Chat Templates

    The sysop can allow for HTML chat to be viewed from a particular WebCrossing server via the "Chat Services" control panel. If HTML is allowed, the user has the choice to view the chat stream by changing their preferences on an individual basis. If a user selects "HTML Chat" as their preferred choice, they are automatically taken to the chat room via this interface.

    NOTE: HTML Chat must be served on the same TCP/IP port as the Direct Web Service. It is not available through any other scripting interface such as webx.dll, webx.cgi, fastcgi, etc.

    To customize a template for an HTML Chat user, you must create an additional macro with the same name and append "_html" to the name. This macro will then be used to display the messages and users and accept commands for the user.

    The default chatroom macro checks the various combinations of the site and user preferences and directs the user into the appropriate interface.

    The default chatroom_html macro is used to display the HTML interface for the user.

    There are specific WCTL directives that can be used in the chatroom_html macro. These are:
    roomIp
    roomHandle
    roomPort
    ChatMessages
    ChatTables
    ChatMembers
    These directives are usually placed in an HTML table tag, but can be used anywhere on a page to customize the interface for the HTML chat user.

    » Hosted events

    A hosted or auditorium-style event is one where a featured guest answers questions and interacts with the audience. You may get the latest example of a Web Crossing template file which sets up a "Special Speaker/Monitored Chat" session from our FTP server, called webxChat.tpl or questionChat.tpl

    To run a hosted event in Web Crossing, you need to create three chat tables:

  • an audience table, with automatic overflow every 32 to 50 users. This table allows the audience to interact with each other and to forward questions to the host.

  • a backstage table, where chat monitors and the host can talk privately. The chat monitors use this to pass audience questions and feedback to the host. For example, a chat monitor might pass a question such as "Tom in SF asks what your feelings are about...."

  • a host table, where the host is read/write and all other users are read/only. The audience can read the messages posted to this table, but cannot clutter it up with their chatter.

    Each member of the audience is in two tables: the host table (as read/only), and an audience table (as read/write).

    Each chat host is in two tables: the audience table, and the backstage table. Actually, as audience tables overflow, each chat monitors may have multiple overflow tables up, scanning them all for messages to pass to the host. Chat monitors can also broadcast messages to the audience tables as desired.

    To set up pages with multiple tables in them, see the Customizing your chat room section. To the standard chat room template, you need to add additional tables. For each table, use a section as follows:

    where .xxxx is the unique ID of the table to be entered.

    » Special Host Commands

    There are several host commands that allow for dynamically changing the content around the chat room as appropriate for special speakers, interviews, advertisements, etc. These commands should be used only when you have already customized the chat template to use HTML frames around the chat room, to make it easier to change the content.

    These commands are typed into the message window of a host user just like a normal message.
    1) Display a graphic image over the top of the chat message area effectively "closing" the chat session down for all users in the room. This is useful for telling users about upcoming interviews, or shutting down the session for maintenance, advertising, etc.

    Command: ))g URL
    Example: ))g http://www.webcrossing.com/Images/webxlogo.gif
    NOTE: This must be a FULL URL to a graphic image (.gif or .jpeg) which resides on the same server as the WBChat applet due to Java security restrictions.

    Command: ))g
    Example: ))g
    NOTE: This clears the previously drawn graphic and "reopens" the chat message area.

    2) Display another URL into a pre-defined frame. This allows for dynamically changing content around the chat applet.

    Command: ))f framename URL
    Example: ))f bottom http://www.webcrossing.com/
    NOTE: This must be a FULL URL to a WWW resource (.html, .gif or .jpeg, etc.).

    3) Clear the commands that have been entered. Each command that is entered is saved and as new users enter the room, they are played back to keep newcomers current. To clear the commands enter the following:

    Command: /d clearCommandList
    Example: /d clearCommandList

    4) Begin session level logging of this client.

    Command: /d logSession
    Example: /d logSession

    » Chat protocol

    You are welcome to develop other clients for the Web Crossing chat server. Complete Java source-code for the standard Web Crossing client is available for license.

    The protocol documented below for the chat rooms is public domain, but is subject to change without notice.

    Client to --> Server
    --> intHandle
            [One time only] Send client handle number (an integer) to server for
            initial connection. The handle is assigned by the chat server at the
            time the HTML page for the Java client applet is generated.
    
    --> n username
            (Name) Set new name for this user. Note that this command is
            ignored if the user is not allowed to change names at the server. Note
            that at signs (@) are removed from the name by the server.
    
    --> m message
            (Message) Broadcasts the message to all other users in the chat room.
            The server will add the sender's name (see following
            server-->client "m" command).
    
    --> p users@message
            (Private message) Send "message" to a list of user handles, comma
            delimited.  For example, "p 12,53,2@Hi everyone" will send "Hi everyone" to
            users 2, 12, and 53.
    
    --> c table
            (Change tables) Request the server to move the client to a different
            table.  "table" is the handle of the new table.  The server will
            respond with a "c..." message on completion.
    
    --> l text
            (Log) If the server's log file is turned on, then log the text.
            This may be used to forward any desired information from the client
            to the server for later analysis.
    
    --> e user@minutes@message
            (Eject) Request that the specified user handle be ejected (by
            checking IP addresses) for some number of minutes.  The message will
            be sent to the ejected user prior to ejection.
    
    --> b message
            (Broadcast) Request a broadcast of the message to all tables for which
            this client-user is a host.
    
    --> f uniqueID message
            (Forward) Request a forward of the message to a specific table (uniqueID).
            This table can be in another fan-out server.
    
    --> d command, param1, param2, ...
            (Do Server Command) Sends a command with parameters to the server for
            execution there.  Commands depend on their particular parameters and this
            is extensible.
          --  clearCommandList  
              Clear all of the stored frame change commands from the server.
          --  logSession 
              Begin Session level logging for this connection on the server
    
        --- Private rooms ---
        Each user has their own private table to which they may invite other users.
        This private table has the same unique handle as the user.  Inviting
        another user to a private table adds the table to that user's participant
        access list.
        If the user rejects the invitation, the table is automatically removed from
        their access list.  Otherwise, the table is removed from another user's
        access list when the originator sends an "r c" to that user.
    
    --> r i resph@message
            (private Room Invite, originator --> server)
            Invite a responding user to enter a private room.
            "resph" is the handle of the invited (responding) user.
    
    --> r c userh@message
            (private Room Cancel, originator or responding --> server)
            Cancel a private room.
    
    --> r a origh@message
            (private Room Accept, responding --> server)
            Accept an invitation from an originating user to enter a private room.
            "origh" is the handle of the originating user.
    
    --> r r origh@message
            (private Room Reject, responding --> server)
            Reject an invitation from an originating user to enter a private room
    
    --> s
            (Stop) Close the connection to the client. (Allows graceful close.)
    
    
    Client from <-- Server
    A user handle "h" is a unique integer identifier.
    This ID is unique over the lifetime of the server.
    
    <-- e errNum
            Error number from the server
              ClientErrNone = 0,
              ClientErrBadHandleNonNum  = 1  Bad handle: non-numeric handle value
              ClientErrBadHandleInUse   = 2  Bad handle: handle already in use
              ClientErrBadHandleTooSmall= 3  Bad handle: no allocation, and less than the max handle seen from the control room
              ClientErrNoAllocate       = 4  Handle not obviously bad, but no allocation from the server before timing out
    
    <-- m username@message
            (Message) A "message" from "username"
    
    <-- x username@message
            (Moderated (x) Message) A "message" from "username".  Uses the same format as message
            but can be localized with an error message to the user.  This message is only sent
            to the originator, not to all people in the room.  This message is only sent if the
            user sent a word that is on the "Moderated Word" list located in the Sysop Control panel.
    
    <-- b username@message
            (Broadcast) A broadcast "message" from "username"
    
    <-- p users@message
            (Private message) A private message to a list of user handles.
            The first user handle in the list is the originator of the message.
            For example, "p 52,12@Hi There" is a private message to this
            client (which must be handle 12) from the user with handle 52.
    
    <-- n username@h
            (reName) Install a new name for a user with handle "h"
    
    <-- i username@h
            (In) A new user with handle "h" has joined the table
    
    <-- o username@h
            (Out) An existing user with handle "h" has left the table
    
    <-- l nn
            (Lurkers) Specifies the number of read-only lurkers at the table.
            "nn" can be a number to set the absolute number of lurkers, or
            "+add" or "-subtract" to adjust the number.  E.g. "23" sets the number
            of lurkers to 23; "+2" adds two lurkers; "-5" removes 5 lurkers.
    
    <-- c table
            (Change table) Specifies the "table" handle of the new table for
            this client.  The client must reset its member list to empty and its
            lurkers count to 0.  The server will immediately follow this message
            with a new member list and lurker count.
    
    <-- c /
            (End of change table member list).  Sent after all existing members at
            a table have been sent as "i..." commands.  This allows the client
            to recognize new entries and exits and alert the user.
    
    <-- t th@s@tname
            (Table info) A table available to this user.
            "th" is the handle of the table, a positive unique integer.
            "s" is "h" (host), "p" (participant), "l" (lurker), "u"
            (user private table), or "0" (table has been closed).
            "tname" is the name of the table
    
    <-- r i origh@message
            (private Room Invite server --> responding user)
            Forward a request to enter a private room from the originating
            user to the responding user.  This message will never be sent
            while the responding user is considering a previous invitation --
            the 2nd invitation will be rejected by the server with a
            canned rejection message.
    
    <-- r c otherh@message
            (private Room Cancel server --> originating or responding user)
            Cancel a private room.
    
    <-- r a resph@message
            (private Room Accepted server --> originating user)
            Notifies the originating user that the responder has accepted the
            invitation and is now in the private room.
    
    <-- r r resph@message
            (private Room Rejected server --> originating user)
            Notifies the originating user that the responder has rejected the
            invitation.
    


    Copyright © 1996-2003 by Web Crossing, Inc., San Francisco, California.