-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: Allow session.webRequest in main process to catch WebSocket using socket.io-client #35095
Comments
Reference issue by socket.io is: |
Hi! I'm trying to confirm that this behavior you're seeing is a bug, but I don't understand. Electron's I'm going to close this issue for now as it seems to stem from that confusion I described above. Thanks for asking for clarification! 🙂 |
@clavin Thanks for replay.
Please take a look at this issue again, I am willing to provide all the replications and add any information. Again, thank you very much. @clavin |
The following example simply moves the code from the main process to the rendering process(proload.js) without modifying any of the dependencies or code logic. socket client on the Node Process, which CANNOT be intercepted via WebRequest:https://gist.github.com/a75a9f77e9b96154e777197921e4de6e The Console output receives the incoming logs and intercepts requests as normal.
Comparing with the privous example, maybe this issue not a bug (I'm not sure), but It can not receved the log due to socket client on the Render Process, which can be intercepted via WebRequest as expected:https://gist.github.com/39b56c0169790f1561df3bad80d6c2bf The both example work with the sample server example: server.jsconst express = require("express")
const app = express()
const http = require("http")
const server = http.createServer(app)
const Server = require("socket.io")
const io = new Server(server)
app.get("/", (req, res) => {
res.sendFile(__dirname + "/index.html")
})
io.on("connection", (socket) => {
console.log("a user connected")
socket.on("disconnect", () => {
console.log("user disconnected")
})
})
io.on("connection", (socket) => {
socket.on("chat message", (msg) => {
console.log("message: " + msg)
})
})
server.listen(3000, () => {
console.log("listening on *:3000")
}) package.json{
"dependencies": {
"express": "4",
"http": "0.0.1-security",
"socket.io": "2",
"socket.io-client": "2"
}
} @codebytere @RaisinTen @clavin: Please consider is issue again and consider reopen this issue, thank you very much. |
Reopening since the OP stated that they're using |
I'm sorry, I still don't understand. 😕 Let me show you the investigation I did before that showed me how
So, to sum that all up, yes, Like I said earlier, This is all to say that this behavior is expected and not a bug in Electron. Sorry about this confusion! 🙇 When I said I'll give the OP a couple of days to respond, however my disposition is to still close this issue as not a bug after that time passes. |
@clavin @RaisinTen Thank you very much for such a detailed reply, which directly points out the differences in the implementation of
My real concern is : in Electron eco, we use From now on, I have understood why by reading the source code of So, it's really not a |
No worries! Unfortunately, even as a request for an enhancement I still will be closing this issue. The So while we appreciate this enhancement request, it's not something that we will be able to implement in the near future. Since we use our issues tab as the team's backlog, we prefer to only retain issues that are on our immediate roadmap. So, I'm closing this feature request as not planned right now. I hope that makes sense! |
I just stumbled over this as well now. With the environment variable set DEBUG=socket.* I get the following when trying to open the client connection within the main electron process.
Is this the same as what is being described here? The on connect error or on disconnect events never fire, nor does anything else throw an error or "respond"/just looks like it is waiting/hangs. @leiming @clavin So the conclusion is that we can't run |
@rehanvdm https://gist.github.com/leiming/a75a9f77e9b96154e777197921e4de6e |
Preflight Checklist
Electron Version
19.x.x, 18.x.x, 17.x.x, 16.x.x
What operating system are you using?
Windows
Operating System Version
Windows 10 Version 21H2
What arch are you using?
x64
Last Known Working Electron version
16.x.x
Expected Behavior
The socket request shoud be interrepted by
onBeforeRequest
,onBeforeSendHeaders
:Actual Behavior
Testcase Gist URL
https://gist.github.com/39b56c0169790f1561df3bad80d6c2bf
Additional Information
The Sample of
Electron Fiddle
dependency bysocket.io-client@2
.The ServerSide code is:
server.js
package.json
The text was updated successfully, but these errors were encountered: