Wt examples  3.3.12
Classes | Functions
simpleChat.C File Reference
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WEnvironment>
#include <Wt/WPushButton>
#include <Wt/WServer>
#include <Wt/WText>
#include <Wt/WTimer>
#include "SimpleChatServer.h"
#include "PopupChatWidget.h"

Go to the source code of this file.

Classes

class  ChatApplication
 A chat demo application. More...
 
class  ChatWidget
 A chat application widget. More...
 

Functions

WApplication * createApplication (const WEnvironment &env, SimpleChatServer &server)
 
WApplication * createWidget (const WEnvironment &env, SimpleChatServer &server)
 
int main (int argc, char **argv)
 

Function Documentation

◆ createApplication()

WApplication* createApplication ( const WEnvironment &  env,
SimpleChatServer server 
)

Definition at line 139 of file simpleChat.C.

141 {
142  return new ChatApplication(env, server);
143 }
A chat demo application.
Definition: simpleChat.C:28

◆ createWidget()

WApplication* createWidget ( const WEnvironment &  env,
SimpleChatServer server 
)

Definition at line 145 of file simpleChat.C.

146 {
147  return new ChatWidget(env, server);
148 }
A chat application widget.
Definition: simpleChat.C:99

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 150 of file simpleChat.C.

151 {
152  Wt::WServer server(argc, argv, WTHTTP_CONFIGURATION);
153  SimpleChatServer chatServer(server);
154 
155  /*
156  * We add two entry points: one for the full-window application,
157  * and one for a widget that can be integrated in another page.
158  */
159  server.addEntryPoint(Wt::Application,
160  boost::bind(createApplication, _1,
161  boost::ref(chatServer)));
162  server.addEntryPoint(Wt::WidgetSet,
163  boost::bind(createWidget, _1,
164  boost::ref(chatServer)), "/chat.js");
165 
166  if (server.start()) {
167  int sig = Wt::WServer::waitForShutdown();
168  std::cerr << "Shutting down: (signal = " << sig << ")" << std::endl;
169  server.stop();
170  }
171 }
A simple chat server.
WApplication * createWidget(const WEnvironment &env, SimpleChatServer &server)
Definition: simpleChat.C:145
WApplication * createApplication(const WEnvironment &env, SimpleChatServer &server)
Definition: simpleChat.C:139

Generated on Mon Sep 5 2022 for the C++ Web Toolkit (Wt) by doxygen 1.9.1