Updated ClientSocket and SendNode with API graphs.

This commit is contained in:
Napalys
2025-04-04 09:12:42 +02:00
parent 455ce59583
commit 0dbf951291
4 changed files with 13 additions and 7 deletions

View File

@@ -95,10 +95,10 @@ module ClientWebSocket {
/**
* A client WebSocket instance.
*/
class ClientSocket extends EventEmitter::Range, DataFlow::NewNode, ClientRequest::Range {
class ClientSocket extends EventEmitter::Range, API::NewNode, ClientRequest::Range {
SocketClass socketClass;
ClientSocket() { this = socketClass.getAnInstantiation() }
ClientSocket() { this = socketClass.getAnInvocation() }
/**
* Gets the WebSocket library name.
@@ -129,10 +129,10 @@ module ClientWebSocket {
/**
* A message sent from a WebSocket client.
*/
class SendNode extends EventDispatch::Range, DataFlow::CallNode {
class SendNode extends EventDispatch::Range, API::CallNode {
override ClientSocket emitter;
SendNode() { this = emitter.getAMemberCall("send") }
SendNode() { this = emitter.getReturn().getMember("send").getACall() }
override string getChannel() { result = channelName() }

View File

@@ -36,7 +36,7 @@ import { MyWebSocket, MySockJS, myWebSocketInstance, mySockJSInstance } from './
(function () {
myWebSocketInstance.addEventListener('open', function (event) {
myWebSocketInstance.send('Hi from browser!'); // $ MISSING: clientSend
myWebSocketInstance.send('Hi from browser!'); // $ clientSend
});
myWebSocketInstance.addEventListener('message', function (event) {
@@ -51,7 +51,7 @@ import { MyWebSocket, MySockJS, myWebSocketInstance, mySockJSInstance } from './
(function () {
mySockJSInstance.onopen = function () {
mySockJSInstance.send('test'); // $ MISSING: clientSend
mySockJSInstance.send('test'); // $ clientSend
};
mySockJSInstance.onmessage = function (e) {

View File

@@ -14,7 +14,7 @@ const { MyWebSocketWS, myWebSocketWSInstance } = require('./client.js');
(function () {
myWebSocketWSInstance.on('open', function open() {
myWebSocketWSInstance.send('Hi from client!'); // $ MISSING: clientSend
myWebSocketWSInstance.send('Hi from client!'); // $ clientSend
});
myWebSocketWSInstance.on('message', function incoming(data) {

View File

@@ -12,9 +12,12 @@ clientReceive
clientSend
| browser-custom.js:7:3:7:33 | socket. ... wser!') |
| browser-custom.js:23:3:23:19 | sock.send('test') |
| browser-custom.js:39:9:39:52 | myWebSo ... wser!') |
| browser-custom.js:54:9:54:37 | mySockJ ... 'test') |
| browser.js:5:3:5:33 | socket. ... wser!') |
| browser.js:21:3:21:19 | sock.send('test') |
| client-custom.js:7:3:7:28 | ws.send ... ient!') |
| client-custom.js:17:3:17:47 | myWebSo ... ient!') |
| client.js:7:3:7:28 | ws.send ... ient!') |
clientSocket
| browser-custom.js:4:17:4:54 | new MyW ... :9080') |
@@ -33,9 +36,12 @@ flowSteps
| browser-custom.js:1:54:1:69 | mySockJSInstance | browser-custom.js:1:54:1:69 | mySockJSInstance |
| browser-custom.js:7:15:7:32 | 'Hi from browser!' | server.js:7:38:7:44 | message |
| browser-custom.js:23:13:23:18 | 'test' | sockjs.js:9:31:9:37 | message |
| browser-custom.js:39:34:39:51 | 'Hi from browser!' | server.js:7:38:7:44 | message |
| browser-custom.js:54:31:54:36 | 'test' | sockjs.js:9:31:9:37 | message |
| browser.js:5:15:5:32 | 'Hi from browser!' | server.js:7:38:7:44 | message |
| browser.js:21:13:21:18 | 'test' | sockjs.js:9:31:9:37 | message |
| client-custom.js:7:11:7:27 | 'Hi from client!' | server.js:7:38:7:44 | message |
| client-custom.js:17:30:17:46 | 'Hi from client!' | server.js:7:38:7:44 | message |
| client.js:7:11:7:27 | 'Hi from client!' | server.js:7:38:7:44 | message |
| client.js:15:32:15:44 | require('ws') | client-custom.js:1:9:1:21 | MyWebSocketWS |
| client.js:16:40:16:72 | new Web ... e.org') | client-custom.js:1:24:1:44 | myWebSo ... nstance |