View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide

Simple Chat Step by Step

Here we describe how to build the Simple Chat component already specified. See Simple Chat Specification

1 Retreive the Transcript Component

Here we reuse the TranscriptImpl and TranscriptMaker classes built in the Transcript example

2 Build the Chatter Component

Build the Chatter Component is similar to building the Transcript Component. We just have a client interface in addition.

2.1 Create ChatterImpl

Object subclass: #ChatterImpl
	instanceVariableNames: 'messageToTranscript'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Tutorial-FracTalk-Chat'

2.2 Define the client interface which sends a message

createSendMessageFunctionalType
	| client |
	client := typeFactory 
		createFcItfType: #messageToTranscript
		signature: ((FcSignature newNamed: #sending) 
			addSelector: #show:;
			yourself)
		client: true
		optional: false
		collection: false.
	^client

Note: the variable name in ChatterImpl must be the same as the one given in the interface functional type.

3 Build the Simple Chat Composite

3.1 Define the interfaces

The interfaces are defined the same way as previous.

3.2 Define the behavior

4 Use the Simple Chat

4.1 Create the composite

chat := SimpleChatMaker new newComponent.

4.2 Launch all its sub-components

(chat getFcInterface: #'lifecycle-controller') startWithContent.

4.3 Get the server interface and send it a message

(chat getFcInterface: #writeMessage) say: 'Salut'.


Link to this Page