@@ -110,7 +110,8 @@ exports.createRoom = async (io, socket, data, callback) => {
110110type,
111111state,
112112unreadMessages,
113- lastMessage,
113+ automatedMessage,
114+ notifyMessage,
114115owner_id,
115116is_new,
116117} = data ;
@@ -132,9 +133,10 @@ exports.createRoom = async (io, socket, data, callback) => {
132133const sockets = [ ] ;
133134
134135const saved = await room_dao . joinSocket ( _id , socket . id , creator_id ) ;
135- const saveIncrementalId = await chat_dao . incrementId ( _id ) ;
136- lastMessage . incremental_id = saveIncrementalId ;
137-
136+ const notifyIncrId = await chat_dao . incrementId ( _id ) ;
137+ const autoIncrId = await chat_dao . incrementId ( _id ) ;
138+ notifyMessage . incremental_id = notifyIncrId ;
139+ automatedMessage . incremental_id = autoIncrId ;
138140if ( saved ) {
139141for ( const member of members ) {
140142const memberSockets = await user_dao . getUserSocketsById ( member . user_id ) ;
@@ -151,9 +153,10 @@ exports.createRoom = async (io, socket, data, callback) => {
151153log ( {
152154'createRoom sockets to be notified' :sockets
153155} ) ;
154- const keyedMessage = new km ( 'newMessage' , JSON . stringify ( lastMessage ) ) ;
156+ const notifyKeyedMessage = new km ( 'newMessage' , JSON . stringify ( notifyMessage ) ) ;
157+ const autoKeyedMessage = new km ( 'newMessage' , JSON . stringify ( automatedMessage ) ) ;
155158producer . send ( [ Object . assign ( { } , config . PAYLOAD , {
156- messages :[ keyedMessage ]
159+ messages :[ notifyKeyedMessage , autoKeyedMessage ]
157160} ) ] , function ( e , result ) {
158161if ( e ) {
159162elog ( {
@@ -175,7 +178,7 @@ exports.createRoom = async (io, socket, data, callback) => {
175178 * created and is supposed to emit a "join_room" after reciving
176179 */
177180log ( {
178- 'createRoomlastMessage ' :lastMessage
181+ 'createRoomproducer result ' :result
179182} ) ;
180183io . to ( socket ) . emit ( 'new_room' , Object . assign ( { } , config . RESPONSE , {
181184message :'new_room' ,
@@ -188,7 +191,8 @@ exports.createRoom = async (io, socket, data, callback) => {
188191type,
189192state,
190193unreadMessages,
191- lastMessage,
194+ notifyMessage,
195+ automatedMessage,
192196owner_id,
193197is_new,
194198}
@@ -197,7 +201,10 @@ exports.createRoom = async (io, socket, data, callback) => {
197201socket . join ( _id ) ;
198202callback ( Object . assign ( { } , config . RESPONSE , {
199203message :'room_created' ,
200- data :lastMessage
204+ data :{
205+ notifyMessage,
206+ automatedMessage
207+ }
201208} ) ) ;
202209
203210} else