Added geo_ip lookup.
This commit is contained in:
parent
d8507d0b57
commit
ed88660938
1 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,12 @@ class Sessions::Event::ChatSessionInit < Sessions::Event::ChatBase
|
||||||
return super if super
|
return super if super
|
||||||
return if !check_chat_exists
|
return if !check_chat_exists
|
||||||
|
|
||||||
|
# geo ip lookup
|
||||||
|
geo_ip = nil
|
||||||
|
if @remote_id
|
||||||
|
geo_ip = Service::GeoIp.location(@remote_id)
|
||||||
|
end
|
||||||
|
|
||||||
# create chat session
|
# create chat session
|
||||||
chat_session = Chat::Session.create(
|
chat_session = Chat::Session.create(
|
||||||
chat_id: @payload['data']['chat_id'],
|
chat_id: @payload['data']['chat_id'],
|
||||||
|
@ -12,6 +18,7 @@ class Sessions::Event::ChatSessionInit < Sessions::Event::ChatBase
|
||||||
preferences: {
|
preferences: {
|
||||||
participants: [@client_id],
|
participants: [@client_id],
|
||||||
remote_id: @remote_id,
|
remote_id: @remote_id,
|
||||||
|
geo_ip: geo_ip,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue