Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign uptracker timeout in electron app #1116
Comments
This comment has been minimized.
This comment has been minimized.
|
More info: Im testing the webtorrent-desktop code, and make my own test, removing all, and i can make webtorrent work in the webtorrent-desktop code, my feelings are, that the webtorrent client need to be created in other window process, because if I follow the webtorrent-desktop system (create webtorrent client in other window, and track events from-to main ipc process) the code to client.seed() work correclty Can be that? the webtorrent client only work correctly in a separated thread ? |
This comment has been minimized.
This comment has been minimized.
|
If I'm not wrong, The client needs to be in a nodejs (main or a child) process, not inside a window (as it doesn't have TCP/UDP access). |
This comment has been minimized.
This comment has been minimized.
|
I found the problem:
for some reason the PEER_ID string cause torrent trackers send me a timeout, like the string is not accepted, I remove the peerId in the new webtorrent client, and now works. What im trying to fix now is, the peers who can connect the webtorrent, I can share torrent with webtorrent clients, but im unable to share the torrents with regular TCP/UDP torrent clients (but i can download new torrents form TCP/UDP clients). I test with webtorrentDesktop and have the same issue, so i think is related directly to webtorrent library. |
This comment has been minimized.
This comment has been minimized.
I believe that Electron renderer processes also have Node.js APIs, so you can use WebTorrent there. We moved it to a separate thread because we didn't want to lock up the UI when WebTorrent uses lots of CPU.
If the torrent tracker doesn't recognize which torrent client you're using, or that string is invalid somehow, perhaps that was causing problems.
That shouldn't happen. If you have more information about that, like a specific torrent file (no copyrighted content, please) which can demonstrate the issue, please open a new issue. |
We are using Node.js 7.4.0, Chromium 56.0.2924.87, and Electron 1.6.6.
Im tying to make a simple electron app that read file and share it to webtorrent network (and next step webtorrent-hybrid) but im unable to share any file (or at least is not read by the trackers or something, i try to get the magnet and use in https://instant.io/)
Here is my code:
`const electron = require('electron')
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow
const crypto = require('crypto')
const defaultAnnounceList = require('create-torrent').announceList
const path = require('path')
const url = require('url')
const webtorrent = require('webtorrent')
const createTorrent = require('create-torrent')
const parseTorrent = require('parse-torrent')
// Force use of webtorrent trackers on all torrents
/*
global.WEBTORRENT_ANNOUNCE = defaultAnnounceList
.map((arr) => arr[0])
.filter((url) => url.indexOf('wss://') === 0 || url.indexOf('ws://') === 0)
*/
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600})
// and load the index.html of the app.
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
// Open the DevTools.
mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.`
When I launch this I get this result:
peerID :0.18.0afJajB8CSLwk
magnet:?xt=urn:btih:6b00ed7f0298ee1ad686e2b90779005d6005ad0b&dn=MyMovie.mp4&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com
and after some seconds I get this:
What im doing wrong here? I try to disable windows Firewall and try in linux and get same result, but making ping to explodie.org for example works