0.0.1007 • Published 7 years ago

tixfactory.socket v0.0.1007

Weekly downloads
33
License
-
Repository
github
Last release
7 years ago

TixFactory.Socket

Introduction

TODO

Example

var tfsocket = require("tixfactory.socket");
var socket = new tfsocket(443, "www.roblox.com", true); // port, host, isSecure
var request = Buffer.from("GET /profile?userId=48103520 HTTP/1.1\r\nHost: www.roblox.com\r\n\r\n");

socket.timeout = 2000; // Close the socket after 2 seconds of inactivity

socket.on("write", function (b) {
	console.log("Buffer written to socket\n" + b.toString());
}).on("data", function (b) {
	console.log("Complete data from socket\n" + b.toString());
}).on("connect", function () {
	console.log("Connected:", socket.connected);
}).on("disconnect", function () {
	console.log("Socket disconnected");
}).on("error", function (e) {
	console.error("Socket errored\n", e);
});

socket.write(request).then(function (responseBuffer) {
	//console.log(responseBuffer.toString()); // Same buffer from data event
}).catch(function (e) {
	console.error(e);
});

console.log(socket.port, socket.host, socket.isSecure);
console.log("Waiting to be written:", socket.writeQueue);

// To close the socket call socket.end();
// Raw net/tls socket found at socket.socket
0.0.1007

7 years ago

0.0.1006

7 years ago

0.0.1005

7 years ago

0.0.1004

7 years ago

0.0.1003

7 years ago

0.0.1002

7 years ago

0.0.1001

7 years ago