valeriansaliou/node-sonic-channel là dự án Backend trên GitHub, viết chủ yếu bằng JavaScript, với 151 sao. 🦉 Sonic Channel integration for Node. Used in pair with Sonic, the fast, lightweight and schema-less search backend.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Sonic Channel integration for Node. Used in pair with Sonic, the fast, lightweight and schema-less search backend.
Sonic Channel lets you manage your Sonic search index, from your NodeJS code. Query your index and get search results, push entries to your index and pop them programmatically.
🇫🇷 Crafted in Nantes, France.
Who uses it?
Crisp
👋 You use sonic-channel and you want to be listed there? Contact me.
How to install?
Include sonic-channel in your package.json dependencies.
Alternatively, you can run npm install sonic-channel --save.
How to use?
1️⃣ Search channel
1. Create the connection
node-sonic-channel can be instanciated in search mode as such:
var SonicChannelSearch = require("sonic-channel").Search;
var sonicChannelSearch = new SonicChannelSearch({
host : "::1", // Or '127.0.0.1' if you are still using IPv4
port : 1491, // Default port is '1491'
auth : "SecretPassword" // Authentication password (if any)
}).connect({
connected : function() {
// Connected handler
console.info("Sonic Channel succeeded to connect to host (search).");
},
disconnected : function() {
// Disconnected handler
console.error("Sonic Channel is now disconnected (search).");
},
timeout : function() {
// Timeout handler
console.error("Sonic Channel connection timed out (search).");
},
retrying : function() {
// Retry handler
console.error("Trying to reconnect to Sonic Channel (search)...");
},
error : function(error) {
// Failure handler
console.error("Sonic Channel failed to connect to host (search).", error);
}
});
2. Query the search index
Use the same sonicChannelSearch instance to query the search index:
sonicChannelSearch.query("messages", "default", "valerian saliou")
.then(function(results) {
// Query results come there
})
.catch(function(error) {
// Query errors come there
});
3. Teardown connection
If you need to teardown an ongoing connection to Sonic, use:
sonicChannelSearch.close()
.then(function() {
// Close success handler
})
.catch(function(error) {
// Close errors come there
});
2️⃣ Ingest channel
1. Create the connection
node-sonic-channel can be instanciated in ingest mode as such:
var SonicChannelIngest = require("sonic-channel").Ingest;
var sonicChannelIngest = new SonicChannelIngest({
host : "::1", // Or '127.0.0.1' if you are still using IPv4
port : 1491, // Default port is '1491'
auth : "SecretPassword" // Authentication password (if any)
}).connect({
connected : function() {
// Connected handler
console.info("Sonic Channel succeeded to connect to host (ingest).");
},
disconnected : function() {
// Disconnected handler
console.error("Sonic Channel is now disconnected (ingest).");
},
timeout : function() {
// Timeout handler
console.error("Sonic Channel connection timed out (ingest).");
},
retrying : function() {
// Retry handler
console.error("Trying to reconnect to Sonic Channel (ingest)...");
},
error : function(error) {
// Failure handler
console.error("Sonic Channel failed to connect to host (ingest).", error);
}
});
2. Manage the search index
Use the same sonicChannelIngest instance to push text to the search index:
sonicChannelIngest.push("messages", "default", "conversation:1", "I met Valerian Saliou yesterday. Great fun!")
.then(function() {
// Push success handler
})
.catch(function(error) {
// Push errors come there
});
3. Teardown connection
If you need to teardown an ongoing connection to Sonic, use:
sonicChannelIngest.close()
.then(function() {
// Close success handler
})
.catch(function(error) {
// Close errors come there
});
3️⃣ Control channel
1. Create the connection
node-sonic-channel can be instanciated in control mode as such:
var SonicChannelControl = require("sonic-channel").Control;
var sonicChannelControl = new SonicChannelControl({
host : "::1", // Or '127.0.0.1' if you are still using IPv4
port : 1491, // Default port is '1491'
auth : "SecretPassword" // Authentication password (if any)
}).connect({
connected : function() {
// Connected handler
console.info("Sonic Channel succeeded to connect to host (control).");
},
disconnected : function() {
// Disconnected handler
console.error("Sonic Channel is now disconnected (control).");
},
timeout : function() {
// Timeout handler
console.error("Sonic Channel connection timed out (control).");
},
retrying : function() {
// Retry handler
console.error("Trying to reconnect to Sonic Channel (control)...");
},
error : function(error) {
// Failure handler
console.error("Sonic Channel failed to connect to host (control).", error);
}
});
2. Administrate your Sonic server
You may use the same sonicChannelControl instance to administrate your Sonic server.
3. Teardown connection
If you need to teardown an ongoing connection to Sonic, use:
sonicChannelControl.close()
.then(function() {
// Close success handler
})
.catch(function(error) {
// Close errors come there
});
List of channel methods
For details on argument values, see the Sonic Channel Protocol specification.
ℹ️ Wondering what Sonic is? Check out valeriansaliou/sonic.
How is it linked to Sonic?
node-sonic-channel maintains persistent TCP connections to the Sonic network interfaces that are listening on your running Sonic instance. In case node-sonic-channel gets disconnected from Sonic, it will retry to connect once the connection is established again.
You can configure the connection details of your Sonic instance when initializing node-sonic-channel from your code; via the Sonic host and port.
Đọc thêm về valeriansaliou/node-sonic-channel ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/valeriansaliou/node-sonic-channel là nguồn chính thức.
valeriansaliou/node-sonic-channel có những chủ đề gì?
GitHub topics của valeriansaliou/node-sonic-channel: "graph", "index", "nodejs", "npm", "npm-package", "search", "sonic". TopGit xếp repo vào nhóm Backend.
valeriansaliou/node-sonic-channel có phải mã nguồn mở không?
Có — valeriansaliou/node-sonic-channel phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/valeriansaliou/node-sonic-channel.
valeriansaliou/node-sonic-channel có trang demo không?
Dự án có trang chủ ở https://www.npmjs.com/package/sonic-channel. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
valeriansaliou/node-sonic-channel còn đang phát triển không?
Commit gần nhất trên valeriansaliou/node-sonic-channel là 21 ngày trước (theo timestamp GitHub). Repo có 7 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
valeriansaliou/node-sonic-channel dùng license gì?
valeriansaliou/node-sonic-channel phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về node-sonic-channel?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về node-sonic-channel.