fix ws router issues

This commit is contained in:
Nuwan 2023-03-31 03:48:08 +05:30
parent 3842874226
commit 3554ba63b6
3 changed files with 6 additions and 7 deletions

View File

@ -147,7 +147,9 @@ SQL
# NOTE this is only used for testing purposes; # NOTE this is only used for testing purposes;
# actual deletes will be processed in the websocket context which cleans up dependencies # actual deletes will be processed in the websocket context which cleans up dependencies
def expire_stale_connections(gateway_name) def expire_stale_connections(gateway_name)
self.stale_connection_client_ids(gateway_name).each { |client| self.delete_connection(client[:client_id]) } self.stale_connection_client_ids(gateway_name).each { |client|
self.delete_connection(client[:client_id])
}
end end
def connection_client_ids_for_gateway(gateway_name) def connection_client_ids_for_gateway(gateway_name)

View File

@ -10,7 +10,6 @@ PATH
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
remote: https://jamjam:blueberryjam@int.jamkazam.com/gems/
remote: https://int.jamkazam.com/gems/ remote: https://int.jamkazam.com/gems/
specs: specs:
aasm (5.4.0) aasm (5.4.0)

View File

@ -492,7 +492,7 @@ module JamWebsockets
websocket_comm(client, nil) do websocket_comm(client, nil) do
client.x_forwarded_for = handshake.headers["X-Forwarded-For"] client.x_forwarded_for = handshake.headers["X-Forwarded-For"]
client.query = handshake.query client.query = handshake.query
#handle_login(client, client.query, client.x_forwarded_for) handle_login(client, client.query, client.x_forwarded_for)
end end
} }
} }
@ -645,9 +645,7 @@ module JamWebsockets
client.query["token"] = client_msg.login.token client.query["token"] = client_msg.login.token
client.query["username"] = client_msg.login.username client.query["username"] = client_msg.login.username
client.query["password"] = client_msg.login.password client.query["password"] = client_msg.login.password
time_it('login') { time_it('login') { handle_login(client, client.query, client.x_forwarded_for, false) }
#handle_login(client, client.query, client.x_forwarded_for, false)
}
elsif client_msg.type == ClientMessage::Type::LOGOUT elsif client_msg.type == ClientMessage::Type::LOGOUT
# this is currently only a jamblaster path # this is currently only a jamblaster path
time_it('login') { handle_logout(client) } time_it('login') { handle_logout(client) }
@ -1239,7 +1237,7 @@ module JamWebsockets
if !token.nil? && token != '' if !token.nil? && token != ''
@log.debug "logging in via token" @log.debug "logging in via token"
# attempt login with token # attempt login with token
user = User.find_by(remember_token: token) user = User.find_by_remember_token(token)
if user.nil? if user.nil?
@log.debug "no user found with token #{token}" @log.debug "no user found with token #{token}"