Skip to content
Vahid Hedayati edited this page Nov 12, 2015 · 6 revisions

Config.groovy variables required:

Configure properties by adding following to grails-app/conf/application.groovy under the "wschat" key:

/* Enable / disable spring security - must set this as a key */
wschat.enableSecurity='true'

// Followed by:

grails.plugin.springsecurity.userLookup.userDomainClassName = 'grails.plugin.wschat.ChatAuth'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'grails.plugin.wschat.ChatAuthChatRole'
grails.plugin.springsecurity.authority.className = 'grails.plugin.wschat.ChatRole'
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
        '/':                ['permitAll'],
        '/error':           ['permitAll'],
        '/index':           ['permitAll'],
        '/index.gsp':       ['permitAll'],
        '/shutdown':        ['permitAll'],
        '/assets/**':       ['permitAll'],
        '/**/js/**':        ['permitAll'],
        '/**/css/**':       ['permitAll'],
        '/**/images/**':    ['permitAll'],
        '/**/favicon.ico':  ['permitAll'],
        '/wsChat/**':       ['permitAll'],
        '/wsChatAdmin/**':       ['permitAll'],
        '/wsCamEndpoint/**':		['permitAll'],
        '/wsChatEndpoint/**':		['permitAll'],
        '/wsChatFileEndpoint/**':	['permitAll'],
        '/TicTacToeServer/**':		['permitAll'],
        '/wsCamEndpoint':		['permitAll'],
        '/wsChatEndpoint':		['permitAll'],
        '/wsChatFileEndpoint':	['permitAll'],
        '/TicTacToeServer':		['permitAll'],
        '/dbconsole/**':       ['permitAll'],
        '/ChatClientEndpoint/**':	['permitAll'],
        '/WsChatClientEndpoint/**':	['permitAll'],
        '/ChatClientEndpoint':	['permitAll'],
        '/WsChatClientEndpoint':	['permitAll']
]

grails.plugin.springsecurity.securityConfigType = "Annotation"



/*
* To disable default login page set following
* session.wschatuser must be set and now simply
*/
wschat.disable.login = "yes"


/*
* Your page title
*/
wschat.title='Grails Websocket Chat'


/* 
* Your page heading
*/
wschat.heading='Grails Websocket Chat'


/*
* This is the most important configuration 
* in my current version the hostname is being defined by tomcat start up setenv.sh
* In my tomcat setenv.sh I have
* HOSTNAME=$(hostname)
* JAVA_OPTS="$JAVA_OPTS -DSERVERURL=$HOSTNAME"
*
* Now as per below the hostname is getting set to this value
* if not defined wschat will default it localhost:8080
*
*/
wschat.hostname=System.getProperty('SERVERURL')+":8080"


/* timeout 
* 0.10+ feature
* This is the default timeout value for your chat users.
* by default it is set to 0 which means indefinite login.
* If you wish to get user to be timed out if inactive set this to a millisecond value
*/
wschat.timeout=0
wschat.camtimeout=0

/*dbsupport
* 0.10 +
* can be set to NO - 
* this will stop ban/kick add/remove friend features
* not really played with this myself.
*/
wschat.dbsupport='YES'

/*defaultperm
* this be your chat users being added to db
* wschat.defaultperm='admin'
* by default it is set to user if nothing defined
*/
wschat.defaultperm='user'

/*rooms
* this is the list of rooms that user can choose to join
* if defined it will list them in the default index page
* if not it will check db room table if not in db either
* then default wschat room set for all 
*/

wschat.rooms = ['room1','room2']


/*
* show room heading or not by default it will
*/
wschat.showtitle="NO"




/*
* 1.1+ WEBRTC :
* STUN SERVER CONFIGURATION
* Please add a block like this below to your Config.groovy
*/

stunServers {
	iceServers=[
		[url: 'stun:stun.l.google.com:19302']
	]
}


/* 
*If you do not set left/join room to a value by default
* it will log joiners/leavers. You can set the timeout value 
* by default to 0 to a ms value of your preference if user out/in is quick
* This may slow down msg being sent..
* Logleavers sets a log.error to a value of current username room to verify
* abnormalities in the username (spaces and so forth)
* by default this is no
* so set a timeout if you wish which is only worthy if send.leftroom='yes'
* 
*/ 
wschat.left.timeout='1000'
wschat.send.leftroom='no'
wschat.logleavers='yes'
wschat.send.joinroom='no'

/*
* On next release used for chatClient feature.
* by default treated as false
* puts values in synchronized HashMap Set 
* 
*/
wschat.storeForFrontEnd=false

/*
* frontend client tag lib default naming convention
* for front end it will end with by default _frontend
*/
wschat.frontenduser='_frontend'


/* 
* Add application name to websocket calls?
* http://localhost:8080/yourApp
* will become : http://localhost:8080/
* For grails 3 apps this should be set to no
*/
wschat.add.appName='no' 

/* Persist chat conversation to DB
*/
wschat.dbstore=true
wschat.dbstore_pm_messages=true
wschat.dbstore_room_messages=true
//wschat.dbstore_user_messages=true 

/*Messaging debug - email debug*/
wschat.debug='anyvalue'

/* DB Booking Date
* used for comparing booked room date against now
*/
 wschat.db.booking ?: "yyyy-MM-dd HH:mm:ss"


/*Offline Messages: Private messages persisted for next login?
*/
wschat.offline_pm=true


/* send users list - by default it is yes*/
wschat.send.userList='no'

Chat Bot in main chat rooms:

wschat.enable_Chat_Bot=true
wschat.enable_Chat_AI=true
wschat.enable_Chat_BadWords=true

LiveChat configuration options

wschat.liveChatAssistant='assistant' // the chat client assistant name.. so if userx requests chat .. userx_assistant = this what this is . 
wschat.liveChatPerm='admin'  // this is the group of users that livechat belongs to and if those uses have an email address in profile they will also be emailed

/* 
* These 3 fields config items are useful for me
* as developer who fires up new apps to test.
* I can set a default hardcoded admin user to 
* auto email with live chat request
* Not recommended for your use simply because
* if defaultperm is set to anything than admin 
* this process will likely fail when hard coded admin
* attempts to join the actual live chat
* -----------------------------------------------------------------
* Remember when this hard coded joins the first chat room
* they will also be added to the ChatUserDB as part of their login
* So its best just to configure your BootStrap to add admin members
* and assign them with an email from when your app starts up.
*/
//wschat.liveContactEmail='youremail@gmail.com' // this is the hard coded live chat email 
//wschat.liveChatUsername='masterv'  // this is the nickname upon them joining a live request
//wschat.liveContactName='Mr V'  // this is the person that email title is set to


wschat.emailFrom="me@domain.com"  //this is for sending emails
wschat.store_live_messages=true  // store records of offline messaging
wschat.enable_AI=true  // enable Aritificial Intelligence ? refer to ChatAI.groovy for example and understanding
wschat.liveChatTitle="My Live chat"
wschat.liveChatAskName='true'
wschat.liveChatAskEmail='true'

All variables found by looking up:

wschat.add.appName
wschat.addAppName
wschat.app.id
wschat.autocomplete
wschat.botLiveMessage
Clone this wiki locally