diff src/lib/Chat.luan @ 12:9f45d32670ae

server push
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 31 Oct 2024 21:40:57 -0600
parents 563a5358f2ee
children e2b7f6393dab
line wrap: on
line diff
--- a/src/lib/Chat.luan	Thu Oct 31 19:17:53 2024 -0600
+++ b/src/lib/Chat.luan	Thu Oct 31 21:40:57 2024 -0600
@@ -6,8 +6,11 @@
 local is_empty = Table.is_empty or error()
 local Time = require "luan:Time.luan"
 local time_now = Time.now or error()
+local Http = require "luan:http/Http.luan"
 local Db = require "site:/lib/Db.luan"
 local run_in_transaction = Db.run_in_transaction or error()
+local Utils = require "site:/lib/Utils.luan"
+local base_url = Utils.base_url or error()
 
 
 local Chat = {}
@@ -62,6 +65,11 @@
 		return concat( t, ", " )
 	end
 
+	function chat.http_push(message)
+		local url = base_url().."/chat/"..chat.id
+		Http.push(url,message)
+	end
+
 	return chat
 end