MCPcopy
hub / github.com/socketio/socket.io / setUsername

Function setUsername

examples/cluster-traefik/server/public/main.js:39–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38 // Sets the client's username
39 function setUsername () {
40 username = cleanInput($usernameInput.val().trim());
41
42 // If the username is valid
43 if (username) {
44 $loginPage.fadeOut();
45 $chatPage.show();
46 $loginPage.off('click');
47 $currentInput = $inputMessage.focus();
48
49 // Tell the server your username
50 socket.emit('add user', username);
51 }
52 }
53
54 // Sends a chat message
55 function sendMessage () {

Callers 1

main.jsFile · 0.70

Calls 2

cleanInputFunction · 0.70
emitMethod · 0.65

Tested by

no test coverage detected