ACTIVE SERVER PAGE > classic ASP FCM (Ǫ½Ã) ¼¹ö ¿¹Á¦
µî·ÏÀÏ : 2022-02-26 12:52
Á¶È¸¼ö : 53,887
Response.charset = "EUC-KR"
Server.ScriptTimeOut=300
posturl = "https://fcm.googleapis.com/fcm/send"
'ÆÄÀ̾À̽º¿¡¼ ¹ÞÀº ¼¹öÅ°
serverkey = "AAAAmx3d5H8:AP..."
push_title = "¾È³çÇϼ¼¿ä - ¿£ÅͼÒÇÁÆ® ÀÔ´Ï´Ù."
push_contents = "Ǫ½Ã¾Ë¶÷ ³»¿ëÀÔ´Ï´Ù. °¨»çÇÕ´Ï´Ù."
push_url = "http://ankyu.entersoft.kr"
'Àü¼Û¹ÞÀ» ÈÞ´ëÆù ÅäÅ«
token1 = "cTOfHi46TQWOjncK8vzhRd:APA91bE8GIhFtcOX1vu...."
token2 = "dtNTosAASSCSntt1H6apA6:APA91bEMlA26bxheDoMO2..."
body = body &"{"& Chr(34) &"notification"& Chr(34) &":"
body = body & "{"
body = body & Chr(34) &"title"& Chr(34) &":"& Chr(34) & push_title & Chr(34)
body = body & ","
body = body & Chr(34) &"body"& Chr(34) &":"& Chr(34) & push_contents & Chr(34)
body = body & "},"
body = body & Chr(34) &"data"& Chr(34) &":"
body = body & "{"
body = body & Chr(34) &"url"& Chr(34) &":"& Chr(34) & push_url & Chr(34)
body = body & "},"
'Ǫ½Ã¹Þ´Â »ç¶÷ÀÌ 1¸íÀÎ °æ¿ì
'body = body & Chr(34) &"to"& Chr(34) &":"
'body = body & Chr(34) & token1 & Chr(34)
'Ǫ½Ã¹Þ´Â »ç¶÷ÀÌ ¿©·¯¸íÀÎ °æ¿ì (1~1000)
body = body & Chr(34) & "registration_ids"& Chr(34) &": "
body = body & "["
body = body & Chr(34)& token1 & Chr(34)
body = body & ","
body = body & Chr(34)& token2 & Chr(34)
body = body & "]"
body = body &"}"
'json ±¸Á¶¸¦ Ãâ·ÂÇØ º»´Ù.
'response.write body &"<br><Br>"
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST",posturl,false
xmlhttp.setRequestHeader "Content-Type", "application/json"
xmlhttp.setRequestHeader "Authorization", "key="&serverkey
xmlhttp.send body
result= xmlhttp.responseText
response.write "<br>"&result
Set xmlhttp = Nothing
asp ·Î ¸¸µç FCM Ǫ½ÃÀü¼Û ¼Ò½º°¡ ¸¹ÀÌ ¾ø¾î¼ °³¹ßÇÒ¶§ Á¶±Ý ¾Ö¸¦ ¸ÔÀº°Å °°½À´Ï´Ù.
µµ¿òÀÌ µÇ½Ã±æ...
Ǫ½Ã±â´ÉÀº Çѹø¿¡ º¸³¾¶§ 1000 ¸í±îÁö ÀΰɷΠ¾Ë°í ÀÖ½À´Ï´Ù. º¸³»¾ßÇÒ °¹¼ö°¡ 10000¸íÀ̶ó°í °¡Á¤ÇÒ¶§´Â ¾î¶»°Ô ÇؾßÇÒ±î..
°í¹ÎÀ» ÇÑ ³¡¿¡ 'Àü¼Û'¹öÆ°À» ´·¶À»¶§, ajax ¹Ýº¹ÀÛ¾÷À¸·Î Àü¼ÛÆäÀÌÁö¸¦ 1~2ÃÊ¿¡ Çѹø¾¿ Àü¼ÛÀ» ÇØ ÁÖ¸é µÉ°Å °°´Ù.
ÇѹøÀü¼ÛÇÒ¶§ 1000¸í¾¿, 10000¸íÀ̸é 10¹ø¸¸ javascript setInterval() À» ÀÌ¿ëÇØ Ã³¸®ÇÏ¸é ¹«³ÇÏ°Ô °³¹ßÀÌ °¡´ÉÇÒ°Å °°´Ù.