Skip to content

Commit

Permalink
refactored typo onMenssage to onMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
Awhiteweb committed May 24, 2023
1 parent 3344d56 commit 6884a65
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
20 changes: 10 additions & 10 deletions .tests/Projects/Network/NT/Modules/SocketInterfaces.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe('Testing addCaller queue ordering', () => {
socketInterfaceModule.initialize()
const timestamp = Date.now().valueOf()

await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
Expand All @@ -191,19 +191,19 @@ describe('Testing addCaller queue ordering', () => {
socketInterfaceModule.initialize()
const timestamp = Date.now().valueOf()

await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
signature: userSignature(userOne.name, timestamp)
}), caller(userOne.balance), timestamp)
await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
signature: userSignature(userTwo.name, timestamp)
}), caller(userTwo.balance), timestamp)
await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
Expand All @@ -226,19 +226,19 @@ describe('Testing addCaller queue ordering', () => {
socketInterfaceModule.initialize()
const timestamp = Date.now().valueOf()

await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
signature: userSignature(userThree.name, timestamp)
}), caller(userThree.balance), timestamp)
await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
signature: userSignature(userTwo.name, timestamp)
}), caller(userTwo.balance), timestamp)
await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
Expand All @@ -261,19 +261,19 @@ describe('Testing addCaller queue ordering', () => {
socketInterfaceModule.initialize()
const timestamp = Date.now().valueOf()

await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
signature: userSignature(userTwo.name, timestamp)
}), caller(userTwo.balance), timestamp)
await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
signature: userSignature(userOne.name, timestamp)
}), caller(userOne.balance), timestamp)
await socketInterfaceModule.onMenssage(JSON.stringify({
await socketInterfaceModule.onMessage(JSON.stringify({
step: 'Two',
messageType: 'Handshake',
callerRole: '',
Expand Down
4 changes: 2 additions & 2 deletions Projects/Network/NT/Modules/SocketInterfaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports.newNetworkModulesSocketInterfaces = function newNetworkModulesSocketInte
userProfilesMap: undefined,
followerMap: undefined,
senderMap: undefined,
onMenssage: onMenssage,
onMessage: onMessage,
onConnectionClosed: onConnectionClosed,
addFollower: addFollower,
removeFollower: removeFollower,
Expand Down Expand Up @@ -142,7 +142,7 @@ exports.newNetworkModulesSocketInterfaces = function newNetworkModulesSocketInte
web3 = undefined
}

async function onMenssage(message, caller, calledTimestamp) {
async function onMessage(message, caller, calledTimestamp) {
try {
let socketMessage
try {
Expand Down
6 changes: 3 additions & 3 deletions Projects/Network/NT/Modules/WebRTCInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ exports.newNetworkModulesWebRTCInterface = function newNetworkModulesWebRTCInter

let calledTimestamp = (new Date()).valueOf()

caller.socket.on('message', onMenssage)
caller.socket.on('message', onMessage)

function onMenssage(message) {
thisObject.socketInterfaces.onMenssage(message, caller, calledTimestamp)
function onMessage(message) {
thisObject.socketInterfaces.onMessage(message, caller, calledTimestamp)
}

function onConnectionClosed() {
Expand Down
2 changes: 1 addition & 1 deletion Projects/Network/NT/Modules/WebSocketsInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSock
caller.socket.on('message', onMessage)

function onMessage(message) {
thisObject.socketInterfaces.onMenssage(message, caller, calledTimestamp)
thisObject.socketInterfaces.onMessage(message, caller, calledTimestamp)
}

function heartbeat() {
Expand Down
4 changes: 2 additions & 2 deletions Projects/Network/SA/Modules/SocketNetworkClients.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ exports.newNetworkModulesSocketNetworkClients = function newNetworkModulesSocket
Network Node and from now on, all response messages will be received
at this following function.
*/
thisObject.socket.onmessage = socketMessage => { onMenssage(socketMessage) }
thisObject.socket.onmessage = socketMessage => { onMessage(socketMessage) }
resolve()
}
}
Expand Down Expand Up @@ -261,7 +261,7 @@ exports.newNetworkModulesSocketNetworkClients = function newNetworkModulesSocket
}
}

function onMenssage(socketMessage) {
function onMessage(socketMessage) {

let messageHeader = JSON.parse(socketMessage.data)
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ exports.newPortfolioManagementModulesPortfolioManagerEventsClient = function (pr
Second, Raise Event
*/
message.messageId = SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
onMessageFunctionsMap.set(message.messageId, onMenssageFunction)
onMessageFunctionsMap.set(message.messageId, onMessageFunction)

TS.projects.foundations.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT.raiseEvent(
SESSION_KEY,
Expand All @@ -64,7 +64,7 @@ exports.newPortfolioManagementModulesPortfolioManagerEventsClient = function (pr
/*
Third, events Callback
*/
function onMenssageFunction(response) {
function onMessageFunction(response) {

if (response !== undefined) {
if (response.reason === undefined) {
Expand Down Expand Up @@ -104,11 +104,11 @@ exports.newPortfolioManagementModulesPortfolioManagerEventsClient = function (pr
}

function onResponse(messageHeader) {
let onMenssageFunction = onMessageFunctionsMap.get(messageHeader.event.messageId)
let onMessageFunction = onMessageFunctionsMap.get(messageHeader.event.messageId)

if (onMenssageFunction !== undefined) {
if (onMessageFunction !== undefined) {
onMessageFunctionsMap.delete(messageHeader.event.messageId)
onMenssageFunction(messageHeader.event)
onMessageFunction(messageHeader.event)
} else {
// This message does not have a request waiting for it, so it will be ignored.
}
Expand Down
20 changes: 10 additions & 10 deletions Social-Trading/Clean-UI/UI/WebSocketsWebAppClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function newWebSocketsWebAppClient() {
socketClient.onerror = err => { onError(err) }

function onConnection() {
socketClient.onmessage = socketMessage => { onMenssage(socketMessage) }
socketClient.onmessage = socketMessage => { onMessage(socketMessage) }
resolve()
}

Expand Down Expand Up @@ -72,17 +72,17 @@ function newWebSocketsWebAppClient() {
messageType: 'Request',
payload: message
}
onMessageFunctionsMap.set(socketMessage.messageId, onMenssageFunction)
onMessageFunctionsMap.set(socketMessage.messageId, onMessageFunction)
socketClient.send(
JSON.stringify(socketMessage)
)

function onMenssageFunction(response) {
function onMessageFunction(response) {
try {
if (response.result === 'Ok') {
resolve(response.data)
} else {
console.log((new Date()).toISOString(), '[ERROR] Web Sockets WebApp Client -> onMenssage -> response.message = ' + response.message)
console.log((new Date()).toISOString(), '[ERROR] Web Sockets WebApp Client -> onMessage -> response.message = ' + response.message)
reject(response.message)
}

Expand All @@ -94,20 +94,20 @@ function newWebSocketsWebAppClient() {
}
}

function onMenssage(socketMessage) {
function onMessage(socketMessage) {

let message = JSON.parse(socketMessage.data)
/*
We get the function that is going to resolve or reject the promise given.
*/
onMenssageFunction = onMessageFunctionsMap.get(message.messageId)
onMessageFunction = onMessageFunctionsMap.get(message.messageId)
onMessageFunctionsMap.delete(message.messageId)

if (onMenssageFunction !== undefined) {
if (onMessageFunction !== undefined) {
/*
The message received is a response to a message sent.
*/
onMenssageFunction(message)
onMessageFunction(message)
} else {
/*
The message received is a not response to a message sent.
Expand All @@ -117,8 +117,8 @@ function newWebSocketsWebAppClient() {
try {
event = JSON.parse(message)
} catch (err) {
console.log((new Date()).toISOString(), '[ERROR] Web Sockets WebApp Client -> onMenssage -> message = ' + message)
console.log((new Date()).toISOString(), '[ERROR] Web Sockets WebApp Client -> onMenssage -> err.stack = ' + err.stack)
console.log((new Date()).toISOString(), '[ERROR] Web Sockets WebApp Client -> onMessage -> message = ' + message)
console.log((new Date()).toISOString(), '[ERROR] Web Sockets WebApp Client -> onMessage -> err.stack = ' + err.stack)
thisObject.socket.close()
return
}
Expand Down

0 comments on commit 6884a65

Please sign in to comment.